texinfo.tex 217 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773
  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{2003-05-04.08}
  7. %
  8. % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
  9. % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
  10. %
  11. % This texinfo.tex file is free software; you can redistribute it and/or
  12. % modify it under the terms of the GNU General Public License as
  13. % published by the Free Software Foundation; either version 2, or (at
  14. % your option) any later version.
  15. %
  16. % This texinfo.tex file is distributed in the hope that it will be
  17. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  18. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. % General Public License for more details.
  20. %
  21. % You should have received a copy of the GNU General Public License
  22. % along with this texinfo.tex file; see the file COPYING. If not, write
  23. % to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  24. % Boston, MA 02111-1307, USA.
  25. %
  26. % In other words, you are welcome to use, share and improve this program.
  27. % You are forbidden to forbid anyone else to use, share and improve
  28. % what you give them. Help stamp out software-hoarding!
  29. %
  30. % Please try the latest version of texinfo.tex before submitting bug
  31. % reports; you can get the latest version from:
  32. % ftp://ftp.gnu.org/gnu/texinfo/texinfo.tex
  33. % (and all GNU mirrors, see http://www.gnu.org/order/ftp.html)
  34. % ftp://tug.org/tex/texinfo.tex
  35. % (and all CTAN mirrors, see http://www.ctan.org),
  36. % and /home/gd/gnu/doc/texinfo.tex on the GNU machines.
  37. %
  38. % The GNU Texinfo home page is http://www.gnu.org/software/texinfo.
  39. %
  40. % The texinfo.tex in any given Texinfo distribution could well be out
  41. % of date, so if that's what you're using, please check.
  42. %
  43. % Send bug reports to bug-texinfo@gnu.org. Please include including a
  44. % complete document in each bug report with which we can reproduce the
  45. % problem. Patches are, of course, greatly appreciated.
  46. %
  47. % To process a Texinfo manual with TeX, it's most reliable to use the
  48. % texi2dvi shell script that comes with the distribution. For a simple
  49. % manual foo.texi, however, you can get away with this:
  50. % tex foo.texi
  51. % texindex foo.??
  52. % tex foo.texi
  53. % tex foo.texi
  54. % dvips foo.dvi -o # or whatever; this makes foo.ps.
  55. % The extra TeX runs get the cross-reference information correct.
  56. % Sometimes one run after texindex suffices, and sometimes you need more
  57. % than two; texi2dvi does it as many times as necessary.
  58. %
  59. % It is possible to adapt texinfo.tex for other languages, to some
  60. % extent. You can get the existing language-specific files from the
  61. % full Texinfo distribution.
  62. \message{Loading texinfo [version \texinfoversion]:}
  63. % If in a .fmt file, print the version number
  64. % and turn on active characters that we couldn't do earlier because
  65. % they might have appeared in the input file name.
  66. \everyjob{\message{[Texinfo version \texinfoversion]}%
  67. \catcode`+=\active \catcode`\_=\active}
  68. \message{Basics,}
  69. \chardef\other=12
  70. % We never want plain's \outer definition of \+ in Texinfo.
  71. % For @tex, we can use \tabalign.
  72. \let\+ = \relax
  73. % Save some plain tex macros whose names we will redefine.
  74. \let\ptexb=\b
  75. \let\ptexbullet=\bullet
  76. \let\ptexc=\c
  77. \let\ptexcomma=\,
  78. \let\ptexdot=\.
  79. \let\ptexdots=\dots
  80. \let\ptexend=\end
  81. \let\ptexequiv=\equiv
  82. \let\ptexexclam=\!
  83. \let\ptexgtr=>
  84. \let\ptexhat=^
  85. \let\ptexi=\i
  86. \let\ptexindent=\indent
  87. \let\ptexlbrace=\{
  88. \let\ptexless=<
  89. \let\ptexplus=+
  90. \let\ptexrbrace=\}
  91. \let\ptexslash=\/
  92. \let\ptexstar=\*
  93. \let\ptext=\t
  94. % If this character appears in an error message or help string, it
  95. % starts a new line in the output.
  96. \newlinechar = `^^J
  97. % Set up fixed words for English if not already set.
  98. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  99. \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
  100. \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
  101. \ifx\putwordin\undefined \gdef\putwordin{in}\fi
  102. \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  103. \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  104. \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
  105. \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  106. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  107. \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
  108. \ifx\putwordof\undefined \gdef\putwordof{of}\fi
  109. \ifx\putwordon\undefined \gdef\putwordon{on}\fi
  110. \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
  111. \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
  112. \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
  113. \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
  114. \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
  115. \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
  116. \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
  117. %
  118. \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  119. \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  120. \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  121. \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  122. \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  123. \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  124. \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  125. \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  126. \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  127. \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  128. \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  129. \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  130. %
  131. \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
  132. \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
  133. \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
  134. \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
  135. \ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi
  136. \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
  137. \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi
  138. % In some macros, we cannot use the `\? notation---the left quote is
  139. % in some cases the escape char.
  140. \chardef\colonChar = `\:
  141. \chardef\commaChar = `\,
  142. \chardef\dotChar = `\.
  143. \chardef\equalChar = `\=
  144. \chardef\exclamChar= `\!
  145. \chardef\questChar = `\?
  146. \chardef\semiChar = `\;
  147. \chardef\spaceChar = `\ %
  148. \chardef\underChar = `\_
  149. % Ignore a token.
  150. %
  151. \def\gobble#1{}
  152. % True if #1 is the empty string, i.e., called like `\ifempty{}'.
  153. %
  154. \def\ifempty#1{\ifemptyx #1\emptymarkA\emptymarkB}%
  155. \def\ifemptyx#1#2\emptymarkB{\ifx #1\emptymarkA}%
  156. % Hyphenation fixes.
  157. \hyphenation{ap-pen-dix}
  158. \hyphenation{eshell}
  159. \hyphenation{mini-buf-fer mini-buf-fers}
  160. \hyphenation{time-stamp}
  161. \hyphenation{white-space}
  162. % Margin to add to right of even pages, to left of odd pages.
  163. \newdimen\bindingoffset
  164. \newdimen\normaloffset
  165. \newdimen\pagewidth \newdimen\pageheight
  166. % Sometimes it is convenient to have everything in the transcript file
  167. % and nothing on the terminal. We don't just call \tracingall here,
  168. % since that produces some useless output on the terminal. We also make
  169. % some effort to order the tracing commands to reduce output in the log
  170. % file; cf. trace.sty in LaTeX.
  171. %
  172. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  173. \def\loggingall{%
  174. \tracingstats2
  175. \tracingpages1
  176. \tracinglostchars2 % 2 gives us more in etex
  177. \tracingparagraphs1
  178. \tracingoutput1
  179. \tracingmacros2
  180. \tracingrestores1
  181. \showboxbreadth\maxdimen \showboxdepth\maxdimen
  182. \ifx\eTeXversion\undefined\else % etex gives us more logging
  183. \tracingscantokens1
  184. \tracingifs1
  185. \tracinggroups1
  186. \tracingnesting2
  187. \tracingassigns1
  188. \fi
  189. \tracingcommands3 % 3 gives us more in etex
  190. \errorcontextlines\maxdimen
  191. }%
  192. % add check for \lastpenalty to plain's definitions. If the last thing
  193. % we did was a \nobreak, we don't want to insert more space.
  194. %
  195. \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  196. \removelastskip\penalty-50\smallskip\fi\fi}
  197. \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  198. \removelastskip\penalty-100\medskip\fi\fi}
  199. \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  200. \removelastskip\penalty-200\bigskip\fi\fi}
  201. % For @cropmarks command.
  202. % Do @cropmarks to get crop marks.
  203. %
  204. \newif\ifcropmarks
  205. \let\cropmarks = \cropmarkstrue
  206. %
  207. % Dimensions to add cropmarks at corners.
  208. % Added by P. A. MacKay, 12 Nov. 1986
  209. %
  210. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  211. \newdimen\cornerlong \cornerlong=1pc
  212. \newdimen\cornerthick \cornerthick=.3pt
  213. \newdimen\topandbottommargin \topandbottommargin=.75in
  214. % Main output routine.
  215. \chardef\PAGE = 255
  216. \output = {\onepageout{\pagecontents\PAGE}}
  217. \newbox\headlinebox
  218. \newbox\footlinebox
  219. % \onepageout takes a vbox as an argument. Note that \pagecontents
  220. % does insertions, but you have to call it yourself.
  221. \def\onepageout#1{%
  222. \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
  223. %
  224. \ifodd\pageno \advance\hoffset by \bindingoffset
  225. \else \advance\hoffset by -\bindingoffset\fi
  226. %
  227. % Do this outside of the \shipout so @code etc. will be expanded in
  228. % the headline as they should be, not taken literally (outputting ''code).
  229. \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}%
  230. \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}%
  231. %
  232. {%
  233. % Have to do this stuff outside the \shipout because we want it to
  234. % take effect in \write's, yet the group defined by the \vbox ends
  235. % before the \shipout runs.
  236. %
  237. \escapechar = `\\ % use backslash in output files.
  238. \indexdummies % don't expand commands in the output.
  239. \normalturnoffactive % \ in index entries must not stay \, e.g., if
  240. % the page break happens to be in the middle of an example.
  241. \shipout\vbox{%
  242. % Do this early so pdf references go to the beginning of the page.
  243. \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi
  244. %
  245. \ifcropmarks \vbox to \outervsize\bgroup
  246. \hsize = \outerhsize
  247. \vskip-\topandbottommargin
  248. \vtop to0pt{%
  249. \line{\ewtop\hfil\ewtop}%
  250. \nointerlineskip
  251. \line{%
  252. \vbox{\moveleft\cornerthick\nstop}%
  253. \hfill
  254. \vbox{\moveright\cornerthick\nstop}%
  255. }%
  256. \vss}%
  257. \vskip\topandbottommargin
  258. \line\bgroup
  259. \hfil % center the page within the outer (page) hsize.
  260. \ifodd\pageno\hskip\bindingoffset\fi
  261. \vbox\bgroup
  262. \fi
  263. %
  264. \unvbox\headlinebox
  265. \pagebody{#1}%
  266. \ifdim\ht\footlinebox > 0pt
  267. % Only leave this space if the footline is nonempty.
  268. % (We lessened \vsize for it in \oddfootingxxx.)
  269. % The \baselineskip=24pt in plain's \makefootline has no effect.
  270. \vskip 2\baselineskip
  271. \unvbox\footlinebox
  272. \fi
  273. %
  274. \ifcropmarks
  275. \egroup % end of \vbox\bgroup
  276. \hfil\egroup % end of (centering) \line\bgroup
  277. \vskip\topandbottommargin plus1fill minus1fill
  278. \boxmaxdepth = \cornerthick
  279. \vbox to0pt{\vss
  280. \line{%
  281. \vbox{\moveleft\cornerthick\nsbot}%
  282. \hfill
  283. \vbox{\moveright\cornerthick\nsbot}%
  284. }%
  285. \nointerlineskip
  286. \line{\ewbot\hfil\ewbot}%
  287. }%
  288. \egroup % \vbox from first cropmarks clause
  289. \fi
  290. }% end of \shipout\vbox
  291. }% end of group with \normalturnoffactive
  292. \advancepageno
  293. \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  294. }
  295. \newinsert\margin \dimen\margin=\maxdimen
  296. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  297. {\catcode`\@ =11
  298. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  299. % marginal hacks, juha@viisa.uucp (Juha Takala)
  300. \ifvoid\margin\else % marginal info is present
  301. \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  302. \dimen@=\dp#1 \unvbox#1
  303. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  304. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  305. }
  306. % Here are the rules for the cropmarks. Note that they are
  307. % offset so that the space between them is truly \outerhsize or \outervsize
  308. % (P. A. MacKay, 12 November, 1986)
  309. %
  310. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  311. \def\nstop{\vbox
  312. {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  313. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  314. \def\nsbot{\vbox
  315. {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  316. % Parse an argument, then pass it to #1. The argument is the rest of
  317. % the input line (except we remove a trailing comment). #1 should be a
  318. % macro which expects an ordinary undelimited TeX argument.
  319. %
  320. \def\parsearg#1{%
  321. \let\next = #1%
  322. \begingroup
  323. \obeylines
  324. \futurelet\temp\parseargx
  325. }
  326. % If the next token is an obeyed space (from an @example environment or
  327. % the like), remove it and recurse. Otherwise, we're done.
  328. \def\parseargx{%
  329. % \obeyedspace is defined far below, after the definition of \sepspaces.
  330. \ifx\obeyedspace\temp
  331. \expandafter\parseargdiscardspace
  332. \else
  333. \expandafter\parseargline
  334. \fi
  335. }
  336. % Remove a single space (as the delimiter token to the macro call).
  337. {\obeyspaces %
  338. \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  339. {\obeylines %
  340. \gdef\parseargline#1^^M{%
  341. \endgroup % End of the group started in \parsearg.
  342. %
  343. % First remove any @c comment, then any @comment.
  344. % Result of each macro is put in \toks0.
  345. \argremovec #1\c\relax %
  346. \expandafter\argremovecomment \the\toks0 \comment\relax %
  347. %
  348. % Call the caller's macro, saved as \next in \parsearg.
  349. \expandafter\next\expandafter{\the\toks0}%
  350. }%
  351. }
  352. % Since all \c{,omment} does is throw away the argument, we can let TeX
  353. % do that for us. The \relax here is matched by the \relax in the call
  354. % in \parseargline; it could be more or less anything, its purpose is
  355. % just to delimit the argument to the \c.
  356. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  357. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  358. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  359. % @end itemize @c foo
  360. % will have two active spaces as part of the argument with the
  361. % `itemize'. Here we remove all active spaces from #1, and assign the
  362. % result to \toks0.
  363. %
  364. % This loses if there are any *other* active characters besides spaces
  365. % in the argument -- _ ^ +, for example -- since they get expanded.
  366. % Fortunately, Texinfo does not define any such commands. (If it ever
  367. % does, the catcode of the characters in questionwill have to be changed
  368. % here.) But this means we cannot call \removeactivespaces as part of
  369. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  370. % that \parsearg gets might well have any character at all in it.
  371. %
  372. \def\removeactivespaces#1{%
  373. \begingroup
  374. \ignoreactivespaces
  375. \edef\temp{#1}%
  376. \global\toks0 = \expandafter{\temp}%
  377. \endgroup
  378. }
  379. % Change the active space to expand to nothing.
  380. %
  381. \begingroup
  382. \obeyspaces
  383. \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  384. \endgroup
  385. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  386. %% These are used to keep @begin/@end levels from running away
  387. %% Call \inENV within environments (after a \begingroup)
  388. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  389. \def\ENVcheck{%
  390. \ifENV\errmessage{Still within an environment; press RETURN to continue}
  391. \endgroup\fi} % This is not perfect, but it should reduce lossage
  392. % @begin foo is the same as @foo, for now.
  393. \newhelp\EMsimple{Press RETURN to continue.}
  394. \outer\def\begin{\parsearg\beginxxx}
  395. \def\beginxxx #1{%
  396. \expandafter\ifx\csname #1\endcsname\relax
  397. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  398. \csname #1\endcsname\fi}
  399. % @end foo executes the definition of \Efoo.
  400. %
  401. \def\end{\parsearg\endxxx}
  402. \def\endxxx #1{%
  403. \removeactivespaces{#1}%
  404. \edef\endthing{\the\toks0}%
  405. %
  406. \expandafter\ifx\csname E\endthing\endcsname\relax
  407. \expandafter\ifx\csname \endthing\endcsname\relax
  408. % There's no \foo, i.e., no ``environment'' foo.
  409. \errhelp = \EMsimple
  410. \errmessage{Undefined command `@end \endthing'}%
  411. \else
  412. \unmatchedenderror\endthing
  413. \fi
  414. \else
  415. % Everything's ok; the right environment has been started.
  416. \csname E\endthing\endcsname
  417. \fi
  418. }
  419. % There is an environment #1, but it hasn't been started. Give an error.
  420. %
  421. \def\unmatchedenderror#1{%
  422. \errhelp = \EMsimple
  423. \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  424. }
  425. % Define the control sequence \E#1 to give an unmatched @end error.
  426. %
  427. \def\defineunmatchedend#1{%
  428. \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  429. }
  430. %% Simple single-character @ commands
  431. % @@ prints an @
  432. % Kludge this until the fonts are right (grr).
  433. \def\@{{\tt\char64}}
  434. % This is turned off because it was never documented
  435. % and you can use @w{...} around a quote to suppress ligatures.
  436. %% Define @` and @' to be the same as ` and '
  437. %% but suppressing ligatures.
  438. %\def\`{{`}}
  439. %\def\'{{'}}
  440. % Used to generate quoted braces.
  441. \def\mylbrace {{\tt\char123}}
  442. \def\myrbrace {{\tt\char125}}
  443. \let\{=\mylbrace
  444. \let\}=\myrbrace
  445. \begingroup
  446. % Definitions to produce \{ and \} commands for indices,
  447. % and @{ and @} for the aux file.
  448. \catcode`\{ = \other \catcode`\} = \other
  449. \catcode`\[ = 1 \catcode`\] = 2
  450. \catcode`\! = 0 \catcode`\\ = \other
  451. !gdef!lbracecmd[\{]%
  452. !gdef!rbracecmd[\}]%
  453. !gdef!lbraceatcmd[@{]%
  454. !gdef!rbraceatcmd[@}]%
  455. !endgroup
  456. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  457. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  458. \let\, = \c
  459. \let\dotaccent = \.
  460. \def\ringaccent#1{{\accent23 #1}}
  461. \let\tieaccent = \t
  462. \let\ubaraccent = \b
  463. \let\udotaccent = \d
  464. % Other special characters: @questiondown @exclamdown
  465. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  466. \def\questiondown{?`}
  467. \def\exclamdown{!`}
  468. % Dotless i and dotless j, used for accents.
  469. \def\imacro{i}
  470. \def\jmacro{j}
  471. \def\dotless#1{%
  472. \def\temp{#1}%
  473. \ifx\temp\imacro \ptexi
  474. \else\ifx\temp\jmacro \j
  475. \else \errmessage{@dotless can be used only with i or j}%
  476. \fi\fi
  477. }
  478. % Be sure we're in horizontal mode when doing a tie, since we make space
  479. % equivalent to this in @example-like environments. Otherwise, a space
  480. % at the beginning of a line will start with \penalty -- and
  481. % since \penalty is valid in vertical mode, we'd end up putting the
  482. % penalty on the vertical list instead of in the new paragraph.
  483. {\catcode`@ = 11
  484. % Avoid using \@M directly, because that causes trouble
  485. % if the definition is written into an index file.
  486. \global\let\tiepenalty = \@M
  487. \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  488. }
  489. % @: forces normal size whitespace following.
  490. \def\:{\spacefactor=1000 }
  491. % @* forces a line break.
  492. \def\*{\hfil\break\hbox{}\ignorespaces}
  493. % @/ allows a line break.
  494. \let\/=\allowbreak
  495. % @. is an end-of-sentence period.
  496. \def\.{.\spacefactor=3000 }
  497. % @! is an end-of-sentence bang.
  498. \def\!{!\spacefactor=3000 }
  499. % @? is an end-of-sentence query.
  500. \def\?{?\spacefactor=3000 }
  501. % @w prevents a word break. Without the \leavevmode, @w at the
  502. % beginning of a paragraph, when TeX is still in vertical mode, would
  503. % produce a whole line of output instead of starting the paragraph.
  504. \def\w#1{\leavevmode\hbox{#1}}
  505. % @group ... @end group forces ... to be all on one page, by enclosing
  506. % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
  507. % to keep its height that of a normal line. According to the rules for
  508. % \topskip (p.114 of the TeXbook), the glue inserted is
  509. % max (\topskip - \ht (first item), 0). If that height is large,
  510. % therefore, no glue is inserted, and the space between the headline and
  511. % the text is small, which looks bad.
  512. %
  513. % Another complication is that the group might be very large. This can
  514. % cause the glue on the previous page to be unduly stretched, because it
  515. % does not have much material. In this case, it's better to add an
  516. % explicit \vfill so that the extra space is at the bottom. The
  517. % threshold for doing this is if the group is more than \vfilllimit
  518. % percent of a page (\vfilllimit can be changed inside of @tex).
  519. %
  520. \newbox\groupbox
  521. \def\vfilllimit{0.7}
  522. %
  523. \def\group{\begingroup
  524. \ifnum\catcode13=\active \else
  525. \errhelp = \groupinvalidhelp
  526. \errmessage{@group invalid in context where filling is enabled}%
  527. \fi
  528. %
  529. % The \vtop we start below produces a box with normal height and large
  530. % depth; thus, TeX puts \baselineskip glue before it, and (when the
  531. % next line of text is done) \lineskip glue after it. (See p.82 of
  532. % the TeXbook.) Thus, space below is not quite equal to space
  533. % above. But it's pretty close.
  534. \def\Egroup{%
  535. \egroup % End the \vtop.
  536. % \dimen0 is the vertical size of the group's box.
  537. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
  538. % \dimen2 is how much space is left on the page (more or less).
  539. \dimen2 = \pageheight \advance\dimen2 by -\pagetotal
  540. % if the group doesn't fit on the current page, and it's a big big
  541. % group, force a page break.
  542. \ifdim \dimen0 > \dimen2
  543. \ifdim \pagetotal < \vfilllimit\pageheight
  544. \page
  545. \fi
  546. \fi
  547. \copy\groupbox
  548. \endgroup % End the \group.
  549. }%
  550. %
  551. \setbox\groupbox = \vtop\bgroup
  552. % We have to put a strut on the last line in case the @group is in
  553. % the midst of an example, rather than completely enclosing it.
  554. % Otherwise, the interline space between the last line of the group
  555. % and the first line afterwards is too small. But we can't put the
  556. % strut in \Egroup, since there it would be on a line by itself.
  557. % Hence this just inserts a strut at the beginning of each line.
  558. \everypar = {\strut}%
  559. %
  560. % Since we have a strut on every line, we don't need any of TeX's
  561. % normal interline spacing.
  562. \offinterlineskip
  563. %
  564. % OK, but now we have to do something about blank
  565. % lines in the input in @example-like environments, which normally
  566. % just turn into \lisppar, which will insert no space now that we've
  567. % turned off the interline space. Simplest is to make them be an
  568. % empty paragraph.
  569. \ifx\par\lisppar
  570. \edef\par{\leavevmode \par}%
  571. %
  572. % Reset ^^M's definition to new definition of \par.
  573. \obeylines
  574. \fi
  575. %
  576. % Do @comment since we are called inside an environment such as
  577. % @example, where each end-of-line in the input causes an
  578. % end-of-line in the output. We don't want the end-of-line after
  579. % the `@group' to put extra space in the output. Since @group
  580. % should appear on a line by itself (according to the Texinfo
  581. % manual), we don't worry about eating any user text.
  582. \comment
  583. }
  584. %
  585. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  586. % message, so this ends up printing `@group can only ...'.
  587. %
  588. \newhelp\groupinvalidhelp{%
  589. group can only be used in environments such as @example,^^J%
  590. where each line of input produces a line of output.}
  591. % @need space-in-mils
  592. % forces a page break if there is not space-in-mils remaining.
  593. \newdimen\mil \mil=0.001in
  594. \def\need{\parsearg\needx}
  595. % Old definition--didn't work.
  596. %\def\needx #1{\par %
  597. %% This method tries to make TeX break the page naturally
  598. %% if the depth of the box does not fit.
  599. %{\baselineskip=0pt%
  600. %\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak
  601. %\prevdepth=-1000pt
  602. %}}
  603. \def\needx#1{%
  604. % Ensure vertical mode, so we don't make a big box in the middle of a
  605. % paragraph.
  606. \par
  607. %
  608. % If the @need value is less than one line space, it's useless.
  609. \dimen0 = #1\mil
  610. \dimen2 = \ht\strutbox
  611. \advance\dimen2 by \dp\strutbox
  612. \ifdim\dimen0 > \dimen2
  613. %
  614. % Do a \strut just to make the height of this box be normal, so the
  615. % normal leading is inserted relative to the preceding line.
  616. % And a page break here is fine.
  617. \vtop to #1\mil{\strut\vfil}%
  618. %
  619. % TeX does not even consider page breaks if a penalty added to the
  620. % main vertical list is 10000 or more. But in order to see if the
  621. % empty box we just added fits on the page, we must make it consider
  622. % page breaks. On the other hand, we don't want to actually break the
  623. % page after the empty box. So we use a penalty of 9999.
  624. %
  625. % There is an extremely small chance that TeX will actually break the
  626. % page at this \penalty, if there are no other feasible breakpoints in
  627. % sight. (If the user is using lots of big @group commands, which
  628. % almost-but-not-quite fill up a page, TeX will have a hard time doing
  629. % good page breaking, for example.) However, I could not construct an
  630. % example where a page broke at this \penalty; if it happens in a real
  631. % document, then we can reconsider our strategy.
  632. \penalty9999
  633. %
  634. % Back up by the size of the box, whether we did a page break or not.
  635. \kern -#1\mil
  636. %
  637. % Do not allow a page break right after this kern.
  638. \nobreak
  639. \fi
  640. }
  641. % @br forces paragraph break
  642. \let\br = \par
  643. % @dots{} output an ellipsis using the current font.
  644. % We do .5em per period so that it has the same spacing in a typewriter
  645. % font as three actual period characters.
  646. %
  647. \def\dots{%
  648. \leavevmode
  649. \hbox to 1.5em{%
  650. \hskip 0pt plus 0.25fil minus 0.25fil
  651. .\hss.\hss.%
  652. \hskip 0pt plus 0.5fil minus 0.5fil
  653. }%
  654. }
  655. % @enddots{} is an end-of-sentence ellipsis.
  656. %
  657. \def\enddots{%
  658. \leavevmode
  659. \hbox to 2em{%
  660. \hskip 0pt plus 0.25fil minus 0.25fil
  661. .\hss.\hss.\hss.%
  662. \hskip 0pt plus 0.5fil minus 0.5fil
  663. }%
  664. \spacefactor=3000
  665. }
  666. % @page forces the start of a new page.
  667. %
  668. \def\page{\par\vfill\supereject}
  669. % @exdent text....
  670. % outputs text on separate line in roman font, starting at standard page margin
  671. % This records the amount of indent in the innermost environment.
  672. % That's how much \exdent should take out.
  673. \newskip\exdentamount
  674. % This defn is used inside fill environments such as @defun.
  675. \def\exdent{\parsearg\exdentyyy}
  676. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  677. % This defn is used inside nofill environments such as @example.
  678. \def\nofillexdent{\parsearg\nofillexdentyyy}
  679. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  680. \leftline{\hskip\leftskip{\rm#1}}}}
  681. % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  682. % paragraph. For more general purposes, use the \margin insertion
  683. % class. WHICH is `l' or `r'.
  684. %
  685. \newskip\inmarginspacing \inmarginspacing=1cm
  686. \def\strutdepth{\dp\strutbox}
  687. %
  688. \def\doinmargin#1#2{\strut\vadjust{%
  689. \nobreak
  690. \kern-\strutdepth
  691. \vtop to \strutdepth{%
  692. \baselineskip=\strutdepth
  693. \vss
  694. % if you have multiple lines of stuff to put here, you'll need to
  695. % make the vbox yourself of the appropriate size.
  696. \ifx#1l%
  697. \llap{\ignorespaces #2\hskip\inmarginspacing}%
  698. \else
  699. \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  700. \fi
  701. \null
  702. }%
  703. }}
  704. \def\inleftmargin{\doinmargin l}
  705. \def\inrightmargin{\doinmargin r}
  706. %
  707. % @inmargin{TEXT [, RIGHT-TEXT]}
  708. % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  709. % else use TEXT for both).
  710. %
  711. \def\inmargin#1{\parseinmargin #1,,\finish}
  712. \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  713. \setbox0 = \hbox{\ignorespaces #2}%
  714. \ifdim\wd0 > 0pt
  715. \def\lefttext{#1}% have both texts
  716. \def\righttext{#2}%
  717. \else
  718. \def\lefttext{#1}% have only one text
  719. \def\righttext{#1}%
  720. \fi
  721. %
  722. \ifodd\pageno
  723. \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  724. \else
  725. \def\temp{\inleftmargin\lefttext}%
  726. \fi
  727. \temp
  728. }
  729. % @include file insert text of that file as input.
  730. % Allow normal characters that we make active in the argument (a file name).
  731. \def\include{\begingroup
  732. \catcode`\\=\other
  733. \catcode`~=\other
  734. \catcode`^=\other
  735. \catcode`_=\other
  736. \catcode`|=\other
  737. \catcode`<=\other
  738. \catcode`>=\other
  739. \catcode`+=\other
  740. \parsearg\includezzz}
  741. % Restore active chars for included file.
  742. \def\includezzz#1{\endgroup\begingroup
  743. % Read the included file in a group so nested @include's work.
  744. \def\thisfile{#1}%
  745. \let\value=\expandablevalue
  746. \input\thisfile
  747. \endgroup}
  748. \def\thisfile{}
  749. % @center line
  750. % outputs that line, centered.
  751. %
  752. \def\center{\parsearg\docenter}
  753. \def\docenter#1{{%
  754. \ifhmode \hfil\break \fi
  755. \advance\hsize by -\leftskip
  756. \advance\hsize by -\rightskip
  757. \line{\hfil \ignorespaces#1\unskip \hfil}%
  758. \ifhmode \break \fi
  759. }}
  760. % @sp n outputs n lines of vertical space
  761. \def\sp{\parsearg\spxxx}
  762. \def\spxxx #1{\vskip #1\baselineskip}
  763. % @comment ...line which is ignored...
  764. % @c is the same as @comment
  765. % @ignore ... @end ignore is another way to write a comment
  766. \def\comment{\begingroup \catcode`\^^M=\other%
  767. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  768. \commentxxx}
  769. {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
  770. \let\c=\comment
  771. % @paragraphindent NCHARS
  772. % We'll use ems for NCHARS, close enough.
  773. % NCHARS can also be the word `asis' or `none'.
  774. % We cannot feasibly implement @paragraphindent asis, though.
  775. %
  776. \def\asisword{asis} % no translation, these are keywords
  777. \def\noneword{none}
  778. %
  779. \def\paragraphindent{\parsearg\doparagraphindent}
  780. \def\doparagraphindent#1{%
  781. \def\temp{#1}%
  782. \ifx\temp\asisword
  783. \else
  784. \ifx\temp\noneword
  785. \defaultparindent = 0pt
  786. \else
  787. \defaultparindent = #1em
  788. \fi
  789. \fi
  790. \parindent = \defaultparindent
  791. }
  792. % @exampleindent NCHARS
  793. % We'll use ems for NCHARS like @paragraphindent.
  794. % It seems @exampleindent asis isn't necessary, but
  795. % I preserve it to make it similar to @paragraphindent.
  796. \def\exampleindent{\parsearg\doexampleindent}
  797. \def\doexampleindent#1{%
  798. \def\temp{#1}%
  799. \ifx\temp\asisword
  800. \else
  801. \ifx\temp\noneword
  802. \lispnarrowing = 0pt
  803. \else
  804. \lispnarrowing = #1em
  805. \fi
  806. \fi
  807. }
  808. % @firstparagraphindent WORD
  809. % If WORD is `none', then suppress indentation of the first paragraph
  810. % after a section heading. If WORD is `insert', then do indentat such
  811. % paragraphs.
  812. %
  813. % The paragraph indentation is suppressed or not by calling
  814. % \suppressfirstparagraphindent, which the sectioning commands do. We
  815. % switch the definition of this back and forth according to WORD. By
  816. % default, we suppress indentation.
  817. %
  818. \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
  819. \newdimen\currentparindent
  820. %
  821. \def\insertword{insert}
  822. %
  823. \def\firstparagraphindent{\parsearg\dofirstparagraphindent}
  824. \def\dofirstparagraphindent#1{%
  825. \def\temp{#1}%
  826. \ifx\temp\noneword
  827. \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  828. \else\ifx\temp\insertword
  829. \let\suppressfirstparagraphindent = \relax
  830. \else
  831. \errhelp = \EMsimple
  832. \errmessage{Unknown @firstparagraphindent option `\temp'}%
  833. \fi\fi
  834. }
  835. % Here is how we actually suppress indentation. Redefine \everypar to
  836. % \kern backwards by \parindent, and then reset itself to empty.
  837. %
  838. % We also make \indent itself not actually do anything until the next
  839. % paragraph.
  840. %
  841. \gdef\dosuppressfirstparagraphindent{%
  842. \gdef\indent{%
  843. \global\let\indent=\ptexindent
  844. \global\everypar = {}%
  845. }%
  846. \global\everypar = {%
  847. \kern-\parindent
  848. \global\let\indent=\ptexindent
  849. \global\everypar = {}%
  850. }%
  851. }%
  852. % @asis just yields its argument. Used with @table, for example.
  853. %
  854. \def\asis#1{#1}
  855. % @math outputs its argument in math mode.
  856. % We don't use $'s directly in the definition of \math because we need
  857. % to set catcodes according to plain TeX first, to allow for subscripts,
  858. % superscripts, special math chars, etc.
  859. %
  860. \let\implicitmath = $%$ font-lock fix
  861. %
  862. % One complication: _ usually means subscripts, but it could also mean
  863. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  864. % _ within @math be active (mathcode "8000), and distinguish by seeing
  865. % if the current family is \slfam, which is what @var uses.
  866. %
  867. {\catcode\underChar = \active
  868. \gdef\mathunderscore{%
  869. \catcode\underChar=\active
  870. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  871. }}
  872. %
  873. % Another complication: we want \\ (and @\) to output a \ character.
  874. % FYI, plain.tex uses \\ as a temporary control sequence (why?), but
  875. % this is not advertised and we don't care. Texinfo does not
  876. % otherwise define @\.
  877. %
  878. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  879. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  880. %
  881. \def\math{%
  882. \tex
  883. \mathcode`\_="8000 \mathunderscore
  884. \let\\ = \mathbackslash
  885. \mathactive
  886. \implicitmath\finishmath}
  887. \def\finishmath#1{#1\implicitmath\Etex}
  888. % Some active characters (such as <) are spaced differently in math.
  889. % We have to reset their definitions in case the @math was an
  890. % argument to a command which set the catcodes (such as @item or @section).
  891. %
  892. {
  893. \catcode`^ = \active
  894. \catcode`< = \active
  895. \catcode`> = \active
  896. \catcode`+ = \active
  897. \gdef\mathactive{%
  898. \let^ = \ptexhat
  899. \let< = \ptexless
  900. \let> = \ptexgtr
  901. \let+ = \ptexplus
  902. }
  903. }
  904. % @bullet and @minus need the same treatment as @math, just above.
  905. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  906. \def\minus{\implicitmath-\implicitmath}
  907. % @refill is a no-op.
  908. \let\refill=\relax
  909. % If working on a large document in chapters, it is convenient to
  910. % be able to disable indexing, cross-referencing, and contents, for test runs.
  911. % This is done with @novalidate (before @setfilename).
  912. %
  913. \newif\iflinks \linkstrue % by default we want the aux files.
  914. \let\novalidate = \linksfalse
  915. % @setfilename is done at the beginning of every texinfo file.
  916. % So open here the files we need to have open while reading the input.
  917. % This makes it possible to make a .fmt file for texinfo.
  918. \def\setfilename{%
  919. \iflinks
  920. \readauxfile
  921. \fi % \openindices needs to do some work in any case.
  922. \openindices
  923. \fixbackslash % Turn off hack to swallow `\input texinfo'.
  924. \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  925. %
  926. % If texinfo.cnf is present on the system, read it.
  927. % Useful for site-wide @afourpaper, etc.
  928. % Just to be on the safe side, close the input stream before the \input.
  929. \openin 1 texinfo.cnf
  930. \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi
  931. \closein1
  932. \temp
  933. %
  934. \comment % Ignore the actual filename.
  935. }
  936. % Called from \setfilename.
  937. %
  938. \def\openindices{%
  939. \newindex{cp}%
  940. \newcodeindex{fn}%
  941. \newcodeindex{vr}%
  942. \newcodeindex{tp}%
  943. \newcodeindex{ky}%
  944. \newcodeindex{pg}%
  945. }
  946. % @bye.
  947. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  948. \message{pdf,}
  949. % adobe `portable' document format
  950. \newcount\tempnum
  951. \newcount\lnkcount
  952. \newtoks\filename
  953. \newcount\filenamelength
  954. \newcount\pgn
  955. \newtoks\toksA
  956. \newtoks\toksB
  957. \newtoks\toksC
  958. \newtoks\toksD
  959. \newbox\boxA
  960. \newcount\countA
  961. \newif\ifpdf
  962. \newif\ifpdfmakepagedest
  963. \ifx\pdfoutput\undefined
  964. \pdffalse
  965. \let\pdfmkdest = \gobble
  966. \let\pdfurl = \gobble
  967. \let\endlink = \relax
  968. \let\linkcolor = \relax
  969. \let\pdfmakeoutlines = \relax
  970. \else
  971. \pdftrue
  972. \pdfoutput = 1
  973. \input pdfcolor
  974. \def\dopdfimage#1#2#3{%
  975. \def\imagewidth{#2}%
  976. \def\imageheight{#3}%
  977. % without \immediate, pdftex seg faults when the same image is
  978. % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
  979. \ifnum\pdftexversion < 14
  980. \immediate\pdfimage
  981. \else
  982. \immediate\pdfximage
  983. \fi
  984. \ifx\empty\imagewidth\else width \imagewidth \fi
  985. \ifx\empty\imageheight\else height \imageheight \fi
  986. \ifnum\pdftexversion<13
  987. #1.pdf%
  988. \else
  989. {#1.pdf}%
  990. \fi
  991. \ifnum\pdftexversion < 14 \else
  992. \pdfrefximage \pdflastximage
  993. \fi}
  994. \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}}
  995. \def\pdfmkpgn#1{#1}
  996. \let\linkcolor = \Blue % was Cyan, but that seems light?
  997. \def\endlink{\Black\pdfendlink}
  998. % Adding outlines to PDF; macros for calculating structure of outlines
  999. % come from Petr Olsak
  1000. \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  1001. \else \csname#1\endcsname \fi}
  1002. \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  1003. \advance\tempnum by1
  1004. \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  1005. \def\pdfmakeoutlines{{%
  1006. \openin 1 \jobname.toc
  1007. \ifeof 1\else\begingroup
  1008. \closein 1
  1009. % Thanh's hack / proper braces in bookmarks
  1010. \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
  1011. \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
  1012. %
  1013. \def\chapentry ##1##2##3{}
  1014. \def\secentry ##1##2##3##4{\advancenumber{chap##2}}
  1015. \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}}
  1016. \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}}
  1017. \let\appendixentry = \chapentry
  1018. \let\unnumbchapentry = \chapentry
  1019. \let\unnumbsecentry = \secentry
  1020. \let\unnumbsubsecentry = \subsecentry
  1021. \let\unnumbsubsubsecentry = \subsubsecentry
  1022. \input \jobname.toc
  1023. \def\chapentry ##1##2##3{%
  1024. \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}}
  1025. \def\secentry ##1##2##3##4{%
  1026. \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}}
  1027. \def\subsecentry ##1##2##3##4##5{%
  1028. \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}}
  1029. \def\subsubsecentry ##1##2##3##4##5##6{%
  1030. \pdfoutline goto name{\pdfmkpgn{##6}}{##1}}
  1031. \let\appendixentry = \chapentry
  1032. \let\unnumbchapentry = \chapentry
  1033. \let\unnumbsecentry = \secentry
  1034. \let\unnumbsubsecentry = \subsecentry
  1035. \let\unnumbsubsubsecentry = \subsubsecentry
  1036. %
  1037. % Make special characters normal for writing to the pdf file.
  1038. %
  1039. \indexnofonts
  1040. \let\tt=\relax
  1041. \turnoffactive
  1042. \input \jobname.toc
  1043. \endgroup\fi
  1044. }}
  1045. \def\makelinks #1,{%
  1046. \def\params{#1}\def\E{END}%
  1047. \ifx\params\E
  1048. \let\nextmakelinks=\relax
  1049. \else
  1050. \let\nextmakelinks=\makelinks
  1051. \ifnum\lnkcount>0,\fi
  1052. \picknum{#1}%
  1053. \startlink attr{/Border [0 0 0]}
  1054. goto name{\pdfmkpgn{\the\pgn}}%
  1055. \linkcolor #1%
  1056. \advance\lnkcount by 1%
  1057. \endlink
  1058. \fi
  1059. \nextmakelinks
  1060. }
  1061. \def\picknum#1{\expandafter\pn#1}
  1062. \def\pn#1{%
  1063. \def\p{#1}%
  1064. \ifx\p\lbrace
  1065. \let\nextpn=\ppn
  1066. \else
  1067. \let\nextpn=\ppnn
  1068. \def\first{#1}
  1069. \fi
  1070. \nextpn
  1071. }
  1072. \def\ppn#1{\pgn=#1\gobble}
  1073. \def\ppnn{\pgn=\first}
  1074. \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,}
  1075. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1076. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1077. \ifx\PP\D\let\nextsp\relax
  1078. \else\let\nextsp\skipspaces
  1079. \ifx\p\space\else\addtokens{\filename}{\PP}%
  1080. \advance\filenamelength by 1
  1081. \fi
  1082. \fi
  1083. \nextsp}
  1084. \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
  1085. \ifnum\pdftexversion < 14
  1086. \let \startlink \pdfannotlink
  1087. \else
  1088. \let \startlink \pdfstartlink
  1089. \fi
  1090. \def\pdfurl#1{%
  1091. \begingroup
  1092. \normalturnoffactive\def\@{@}%
  1093. \let\value=\expandablevalue
  1094. \leavevmode\Red
  1095. \startlink attr{/Border [0 0 0]}%
  1096. user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1097. % #1
  1098. \endgroup}
  1099. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1100. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1101. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1102. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1103. \def\maketoks{%
  1104. \expandafter\poptoks\the\toksA|ENDTOKS|
  1105. \ifx\first0\adn0
  1106. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1107. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1108. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1109. \else
  1110. \ifnum0=\countA\else\makelink\fi
  1111. \ifx\first.\let\next=\done\else
  1112. \let\next=\maketoks
  1113. \addtokens{\toksB}{\the\toksD}
  1114. \ifx\first,\addtokens{\toksB}{\space}\fi
  1115. \fi
  1116. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1117. \next}
  1118. \def\makelink{\addtokens{\toksB}%
  1119. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1120. \def\pdflink#1{%
  1121. \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1122. \linkcolor #1\endlink}
  1123. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1124. \fi % \ifx\pdfoutput
  1125. \message{fonts,}
  1126. % Font-change commands.
  1127. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  1128. % So we set up a \sf analogous to plain's \rm, etc.
  1129. \newfam\sffam
  1130. \def\sf{\fam=\sffam \tensf}
  1131. \let\li = \sf % Sometimes we call it \li, not \sf.
  1132. % We don't need math for this one.
  1133. \def\ttsl{\tenttsl}
  1134. % Default leading.
  1135. \newdimen\textleading \textleading = 13.2pt
  1136. % Set the baselineskip to #1, and the lineskip and strut size
  1137. % correspondingly. There is no deep meaning behind these magic numbers
  1138. % used as factors; they just match (closely enough) what Knuth defined.
  1139. %
  1140. \def\lineskipfactor{.08333}
  1141. \def\strutheightpercent{.70833}
  1142. \def\strutdepthpercent {.29167}
  1143. %
  1144. \def\setleading#1{%
  1145. \normalbaselineskip = #1\relax
  1146. \normallineskip = \lineskipfactor\normalbaselineskip
  1147. \normalbaselines
  1148. \setbox\strutbox =\hbox{%
  1149. \vrule width0pt height\strutheightpercent\baselineskip
  1150. depth \strutdepthpercent \baselineskip
  1151. }%
  1152. }
  1153. % Set the font macro #1 to the font named #2, adding on the
  1154. % specified font prefix (normally `cm').
  1155. % #3 is the font's design size, #4 is a scale factor
  1156. \def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4}
  1157. % Use cm as the default font prefix.
  1158. % To specify the font prefix, you must define \fontprefix
  1159. % before you read in texinfo.tex.
  1160. \ifx\fontprefix\undefined
  1161. \def\fontprefix{cm}
  1162. \fi
  1163. % Support font families that don't use the same naming scheme as CM.
  1164. \def\rmshape{r}
  1165. \def\rmbshape{bx} %where the normal face is bold
  1166. \def\bfshape{b}
  1167. \def\bxshape{bx}
  1168. \def\ttshape{tt}
  1169. \def\ttbshape{tt}
  1170. \def\ttslshape{sltt}
  1171. \def\itshape{ti}
  1172. \def\itbshape{bxti}
  1173. \def\slshape{sl}
  1174. \def\slbshape{bxsl}
  1175. \def\sfshape{ss}
  1176. \def\sfbshape{ss}
  1177. \def\scshape{csc}
  1178. \def\scbshape{csc}
  1179. \newcount\mainmagstep
  1180. \ifx\bigger\relax
  1181. % not really supported.
  1182. \mainmagstep=\magstep1
  1183. \setfont\textrm\rmshape{12}{1000}
  1184. \setfont\texttt\ttshape{12}{1000}
  1185. \else
  1186. \mainmagstep=\magstephalf
  1187. \setfont\textrm\rmshape{10}{\mainmagstep}
  1188. \setfont\texttt\ttshape{10}{\mainmagstep}
  1189. \fi
  1190. % Instead of cmb10, you may want to use cmbx10.
  1191. % cmbx10 is a prettier font on its own, but cmb10
  1192. % looks better when embedded in a line with cmr10
  1193. % (in Bob's opinion).
  1194. \setfont\textbf\bfshape{10}{\mainmagstep}
  1195. \setfont\textit\itshape{10}{\mainmagstep}
  1196. \setfont\textsl\slshape{10}{\mainmagstep}
  1197. \setfont\textsf\sfshape{10}{\mainmagstep}
  1198. \setfont\textsc\scshape{10}{\mainmagstep}
  1199. \setfont\textttsl\ttslshape{10}{\mainmagstep}
  1200. \font\texti=cmmi10 scaled \mainmagstep
  1201. \font\textsy=cmsy10 scaled \mainmagstep
  1202. % A few fonts for @defun, etc.
  1203. \setfont\defbf\bxshape{10}{\magstep1} %was 1314
  1204. \setfont\deftt\ttshape{10}{\magstep1}
  1205. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  1206. % Fonts for indices, footnotes, small examples (9pt).
  1207. \setfont\smallrm\rmshape{9}{1000}
  1208. \setfont\smalltt\ttshape{9}{1000}
  1209. \setfont\smallbf\bfshape{10}{900}
  1210. \setfont\smallit\itshape{9}{1000}
  1211. \setfont\smallsl\slshape{9}{1000}
  1212. \setfont\smallsf\sfshape{9}{1000}
  1213. \setfont\smallsc\scshape{10}{900}
  1214. \setfont\smallttsl\ttslshape{10}{900}
  1215. \font\smalli=cmmi9
  1216. \font\smallsy=cmsy9
  1217. % Fonts for small examples (8pt).
  1218. \setfont\smallerrm\rmshape{8}{1000}
  1219. \setfont\smallertt\ttshape{8}{1000}
  1220. \setfont\smallerbf\bfshape{10}{800}
  1221. \setfont\smallerit\itshape{8}{1000}
  1222. \setfont\smallersl\slshape{8}{1000}
  1223. \setfont\smallersf\sfshape{8}{1000}
  1224. \setfont\smallersc\scshape{10}{800}
  1225. \setfont\smallerttsl\ttslshape{10}{800}
  1226. \font\smalleri=cmmi8
  1227. \font\smallersy=cmsy8
  1228. % Fonts for title page:
  1229. \setfont\titlerm\rmbshape{12}{\magstep3}
  1230. \setfont\titleit\itbshape{10}{\magstep4}
  1231. \setfont\titlesl\slbshape{10}{\magstep4}
  1232. \setfont\titlett\ttbshape{12}{\magstep3}
  1233. \setfont\titlettsl\ttslshape{10}{\magstep4}
  1234. \setfont\titlesf\sfbshape{17}{\magstep1}
  1235. \let\titlebf=\titlerm
  1236. \setfont\titlesc\scbshape{10}{\magstep4}
  1237. \font\titlei=cmmi12 scaled \magstep3
  1238. \font\titlesy=cmsy10 scaled \magstep4
  1239. \def\authorrm{\secrm}
  1240. \def\authortt{\sectt}
  1241. % Chapter (and unnumbered) fonts (17.28pt).
  1242. \setfont\chaprm\rmbshape{12}{\magstep2}
  1243. \setfont\chapit\itbshape{10}{\magstep3}
  1244. \setfont\chapsl\slbshape{10}{\magstep3}
  1245. \setfont\chaptt\ttbshape{12}{\magstep2}
  1246. \setfont\chapttsl\ttslshape{10}{\magstep3}
  1247. \setfont\chapsf\sfbshape{17}{1000}
  1248. \let\chapbf=\chaprm
  1249. \setfont\chapsc\scbshape{10}{\magstep3}
  1250. \font\chapi=cmmi12 scaled \magstep2
  1251. \font\chapsy=cmsy10 scaled \magstep3
  1252. % Section fonts (14.4pt).
  1253. \setfont\secrm\rmbshape{12}{\magstep1}
  1254. \setfont\secit\itbshape{10}{\magstep2}
  1255. \setfont\secsl\slbshape{10}{\magstep2}
  1256. \setfont\sectt\ttbshape{12}{\magstep1}
  1257. \setfont\secttsl\ttslshape{10}{\magstep2}
  1258. \setfont\secsf\sfbshape{12}{\magstep1}
  1259. \let\secbf\secrm
  1260. \setfont\secsc\scbshape{10}{\magstep2}
  1261. \font\seci=cmmi12 scaled \magstep1
  1262. \font\secsy=cmsy10 scaled \magstep2
  1263. % Subsection fonts (13.15pt).
  1264. \setfont\ssecrm\rmbshape{12}{\magstephalf}
  1265. \setfont\ssecit\itbshape{10}{1315}
  1266. \setfont\ssecsl\slbshape{10}{1315}
  1267. \setfont\ssectt\ttbshape{12}{\magstephalf}
  1268. \setfont\ssecttsl\ttslshape{10}{1315}
  1269. \setfont\ssecsf\sfbshape{12}{\magstephalf}
  1270. \let\ssecbf\ssecrm
  1271. \setfont\ssecsc\scbshape{10}{\magstep1}
  1272. \font\sseci=cmmi12 scaled \magstephalf
  1273. \font\ssecsy=cmsy10 scaled 1315
  1274. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  1275. % but that is not a standard magnification.
  1276. % In order for the font changes to affect most math symbols and letters,
  1277. % we have to define the \textfont of the standard families. Since
  1278. % texinfo doesn't allow for producing subscripts and superscripts except
  1279. % in the main text, we don't bother to reset \scriptfont and
  1280. % \scriptscriptfont (which would also require loading a lot more fonts).
  1281. %
  1282. \def\resetmathfonts{%
  1283. \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy
  1284. \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf
  1285. \textfont\ttfam=\tentt \textfont\sffam=\tensf
  1286. }
  1287. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  1288. % of just \STYLE. We do this so that font changes will continue to work
  1289. % in math mode, where it is the current \fam that is relevant in most
  1290. % cases, not the current font. Plain TeX does \def\bf{\fam=\bffam
  1291. % \tenbf}, for example. By redefining \tenbf, we obviate the need to
  1292. % redefine \bf itself.
  1293. \def\textfonts{%
  1294. \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  1295. \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  1296. \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl
  1297. \resetmathfonts \setleading{\textleading}}
  1298. \def\titlefonts{%
  1299. \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl
  1300. \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc
  1301. \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy
  1302. \let\tenttsl=\titlettsl
  1303. \resetmathfonts \setleading{25pt}}
  1304. \def\titlefont#1{{\titlefonts\rm #1}}
  1305. \def\chapfonts{%
  1306. \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  1307. \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  1308. \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl
  1309. \resetmathfonts \setleading{19pt}}
  1310. \def\secfonts{%
  1311. \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  1312. \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  1313. \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl
  1314. \resetmathfonts \setleading{16pt}}
  1315. \def\subsecfonts{%
  1316. \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  1317. \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  1318. \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl
  1319. \resetmathfonts \setleading{15pt}}
  1320. \let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf?
  1321. \def\smallfonts{%
  1322. \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl
  1323. \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc
  1324. \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy
  1325. \let\tenttsl=\smallttsl
  1326. \resetmathfonts \setleading{10.5pt}}
  1327. \def\smallerfonts{%
  1328. \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl
  1329. \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc
  1330. \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy
  1331. \let\tenttsl=\smallerttsl
  1332. \resetmathfonts \setleading{9.5pt}}
  1333. % Set the fonts to use with the @small... environments.
  1334. \let\smallexamplefonts = \smallfonts
  1335. % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
  1336. % can fit this many characters:
  1337. % 8.5x11=86 smallbook=72 a4=90 a5=69
  1338. % If we use \smallerfonts (8pt), then we can fit this many characters:
  1339. % 8.5x11=90+ smallbook=80 a4=90+ a5=77
  1340. % For me, subjectively, the few extra characters that fit aren't worth
  1341. % the additional smallness of 8pt. So I'm making the default 9pt.
  1342. %
  1343. % By the way, for comparison, here's what fits with @example (10pt):
  1344. % 8.5x11=71 smallbook=60 a4=75 a5=58
  1345. %
  1346. % I wish we used A4 paper on this side of the Atlantic.
  1347. %
  1348. % --karl, 24jan03.
  1349. % Set up the default fonts, so we can use them for creating boxes.
  1350. %
  1351. \textfonts
  1352. % Define these so they can be easily changed for other fonts.
  1353. \def\angleleft{$\langle$}
  1354. \def\angleright{$\rangle$}
  1355. % Count depth in font-changes, for error checks
  1356. \newcount\fontdepth \fontdepth=0
  1357. % Fonts for short table of contents.
  1358. \setfont\shortcontrm\rmshape{12}{1000}
  1359. \setfont\shortcontbf\bxshape{12}{1000}
  1360. \setfont\shortcontsl\slshape{12}{1000}
  1361. \setfont\shortconttt\ttshape{12}{1000}
  1362. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  1363. %% serif) and @ii for TeX italic
  1364. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  1365. % unless the following character is such as not to need one.
  1366. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else
  1367. \ptexslash\fi\fi\fi}
  1368. \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx}
  1369. \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx}
  1370. \let\i=\smartitalic
  1371. \let\var=\smartslanted
  1372. \let\dfn=\smartslanted
  1373. \let\emph=\smartitalic
  1374. \let\cite=\smartslanted
  1375. \def\b#1{{\bf #1}}
  1376. \let\strong=\b
  1377. % We can't just use \exhyphenpenalty, because that only has effect at
  1378. % the end of a paragraph. Restore normal hyphenation at the end of the
  1379. % group within which \nohyphenation is presumably called.
  1380. %
  1381. \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
  1382. \def\restorehyphenation{\hyphenchar\font = `- }
  1383. % Set sfcode to normal for the chars that usually have another value.
  1384. % Can't use plain's \frenchspacing because it uses the `\x notation, and
  1385. % sometimes \x has an active definition that messes things up.
  1386. %
  1387. \catcode`@=11
  1388. \def\frenchspacing{%
  1389. \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m
  1390. \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m
  1391. }
  1392. \catcode`@=\other
  1393. \def\t#1{%
  1394. {\tt \rawbackslash \frenchspacing #1}%
  1395. \null
  1396. }
  1397. \let\ttfont=\t
  1398. \def\samp#1{`\tclose{#1}'\null}
  1399. \setfont\keyrm\rmshape{8}{1000}
  1400. \font\keysy=cmsy9
  1401. \def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  1402. \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  1403. \vbox{\hrule\kern-0.4pt
  1404. \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  1405. \kern-0.4pt\hrule}%
  1406. \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  1407. % The old definition, with no lozenge:
  1408. %\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null}
  1409. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  1410. % @file, @option are the same as @samp.
  1411. \let\file=\samp
  1412. \let\option=\samp
  1413. % @code is a modification of @t,
  1414. % which makes spaces the same size as normal in the surrounding text.
  1415. \def\tclose#1{%
  1416. {%
  1417. % Change normal interword space to be same as for the current font.
  1418. \spaceskip = \fontdimen2\font
  1419. %
  1420. % Switch to typewriter.
  1421. \tt
  1422. %
  1423. % But `\ ' produces the large typewriter interword space.
  1424. \def\ {{\spaceskip = 0pt{} }}%
  1425. %
  1426. % Turn off hyphenation.
  1427. \nohyphenation
  1428. %
  1429. \rawbackslash
  1430. \frenchspacing
  1431. #1%
  1432. }%
  1433. \null
  1434. }
  1435. % We *must* turn on hyphenation at `-' and `_' in \code.
  1436. % Otherwise, it is too hard to avoid overfull hboxes
  1437. % in the Emacs manual, the Library manual, etc.
  1438. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  1439. % both hyphenation at - and hyphenation within words.
  1440. % We must therefore turn them both off (\tclose does that)
  1441. % and arrange explicitly to hyphenate at a dash.
  1442. % -- rms.
  1443. {
  1444. \catcode`\-=\active
  1445. \catcode`\_=\active
  1446. %
  1447. \global\def\code{\begingroup
  1448. \catcode`\-=\active \let-\codedash
  1449. \catcode`\_=\active \let_\codeunder
  1450. \codex
  1451. }
  1452. %
  1453. % If we end up with any active - characters when handling the index,
  1454. % just treat them as a normal -.
  1455. \global\def\indexbreaks{\catcode`\-=\active \let-\realdash}
  1456. }
  1457. \def\realdash{-}
  1458. \def\codedash{-\discretionary{}{}{}}
  1459. \def\codeunder{%
  1460. % this is all so @math{@code{var_name}+1} can work. In math mode, _
  1461. % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  1462. % will therefore expand the active definition of _, which is us
  1463. % (inside @code that is), therefore an endless loop.
  1464. \ifusingtt{\ifmmode
  1465. \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  1466. \else\normalunderscore \fi
  1467. \discretionary{}{}{}}%
  1468. {\_}%
  1469. }
  1470. \def\codex #1{\tclose{#1}\endgroup}
  1471. % @kbd is like @code, except that if the argument is just one @key command,
  1472. % then @kbd has no effect.
  1473. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  1474. % `example' (@kbd uses ttsl only inside of @example and friends),
  1475. % or `code' (@kbd uses normal tty font always).
  1476. \def\kbdinputstyle{\parsearg\kbdinputstylexxx}
  1477. \def\kbdinputstylexxx#1{%
  1478. \def\arg{#1}%
  1479. \ifx\arg\worddistinct
  1480. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  1481. \else\ifx\arg\wordexample
  1482. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  1483. \else\ifx\arg\wordcode
  1484. \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  1485. \else
  1486. \errhelp = \EMsimple
  1487. \errmessage{Unknown @kbdinputstyle option `\arg'}%
  1488. \fi\fi\fi
  1489. }
  1490. \def\worddistinct{distinct}
  1491. \def\wordexample{example}
  1492. \def\wordcode{code}
  1493. % Default is `distinct.'
  1494. \kbdinputstyle distinct
  1495. \def\xkey{\key}
  1496. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  1497. \ifx\one\xkey\ifx\threex\three \key{#2}%
  1498. \else{\tclose{\kbdfont\look}}\fi
  1499. \else{\tclose{\kbdfont\look}}\fi}
  1500. % For @url, @env, @command quotes seem unnecessary, so use \code.
  1501. \let\url=\code
  1502. \let\env=\code
  1503. \let\command=\code
  1504. % @uref (abbreviation for `urlref') takes an optional (comma-separated)
  1505. % second argument specifying the text to display and an optional third
  1506. % arg as text to display instead of (rather than in addition to) the url
  1507. % itself. First (mandatory) arg is the url. Perhaps eventually put in
  1508. % a hypertex \special here.
  1509. %
  1510. \def\uref#1{\douref #1,,,\finish}
  1511. \def\douref#1,#2,#3,#4\finish{\begingroup
  1512. \unsepspaces
  1513. \pdfurl{#1}%
  1514. \setbox0 = \hbox{\ignorespaces #3}%
  1515. \ifdim\wd0 > 0pt
  1516. \unhbox0 % third arg given, show only that
  1517. \else
  1518. \setbox0 = \hbox{\ignorespaces #2}%
  1519. \ifdim\wd0 > 0pt
  1520. \ifpdf
  1521. \unhbox0 % PDF: 2nd arg given, show only it
  1522. \else
  1523. \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url
  1524. \fi
  1525. \else
  1526. \code{#1}% only url given, so show it
  1527. \fi
  1528. \fi
  1529. \endlink
  1530. \endgroup}
  1531. % rms does not like angle brackets --karl, 17may97.
  1532. % So now @email is just like @uref, unless we are pdf.
  1533. %
  1534. %\def\email#1{\angleleft{\tt #1}\angleright}
  1535. \ifpdf
  1536. \def\email#1{\doemail#1,,\finish}
  1537. \def\doemail#1,#2,#3\finish{\begingroup
  1538. \unsepspaces
  1539. \pdfurl{mailto:#1}%
  1540. \setbox0 = \hbox{\ignorespaces #2}%
  1541. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  1542. \endlink
  1543. \endgroup}
  1544. \else
  1545. \let\email=\uref
  1546. \fi
  1547. % Check if we are currently using a typewriter font. Since all the
  1548. % Computer Modern typewriter fonts have zero interword stretch (and
  1549. % shrink), and it is reasonable to expect all typewriter fonts to have
  1550. % this property, we can check that font parameter.
  1551. %
  1552. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  1553. % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
  1554. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  1555. %
  1556. \def\dmn#1{\thinspace #1}
  1557. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  1558. % @l was never documented to mean ``switch to the Lisp font'',
  1559. % and it is not used as such in any manual I can find. We need it for
  1560. % Polish suppressed-l. --karl, 22sep96.
  1561. %\def\l#1{{\li #1}\null}
  1562. % Explicit font changes: @r, @sc, undocumented @ii.
  1563. \def\r#1{{\rm #1}} % roman font
  1564. \def\sc#1{{\smallcaps#1}} % smallcaps font
  1565. \def\ii#1{{\it #1}} % italic font
  1566. % @acronym downcases the argument and prints in smallcaps.
  1567. \def\acronym#1{{\smallcaps \lowercase{#1}}}
  1568. % @pounds{} is a sterling sign.
  1569. \def\pounds{{\it\$}}
  1570. % @registeredsymbol - R in a circle. For now, only works in text size;
  1571. % we'd have to redo the font mechanism to change the \scriptstyle and
  1572. % \scriptscriptstyle font sizes to make it look right in headings.
  1573. % Adapted from the plain.tex definition of \copyright.
  1574. %
  1575. \def\registeredsymbol{%
  1576. $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}%
  1577. }$%
  1578. }
  1579. \message{page headings,}
  1580. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  1581. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  1582. % First the title page. Must do @settitle before @titlepage.
  1583. \newif\ifseenauthor
  1584. \newif\iffinishedtitlepage
  1585. % Do an implicit @contents or @shortcontents after @end titlepage if the
  1586. % user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage.
  1587. %
  1588. \newif\ifsetcontentsaftertitlepage
  1589. \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue
  1590. \newif\ifsetshortcontentsaftertitlepage
  1591. \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue
  1592. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  1593. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  1594. \endgroup\page\hbox{}\page}
  1595. \def\titlepage{\begingroup \parindent=0pt \textfonts
  1596. \let\subtitlerm=\tenrm
  1597. \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  1598. %
  1599. \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines
  1600. \let\tt=\authortt}%
  1601. %
  1602. % Leave some space at the very top of the page.
  1603. \vglue\titlepagetopglue
  1604. %
  1605. % Now you can print the title using @title.
  1606. \def\title{\parsearg\titlezzz}%
  1607. \def\titlezzz##1{\leftline{\titlefonts\rm ##1}
  1608. % print a rule at the page bottom also.
  1609. \finishedtitlepagefalse
  1610. \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  1611. % No rule at page bottom unless we print one at the top with @title.
  1612. \finishedtitlepagetrue
  1613. %
  1614. % Now you can put text using @subtitle.
  1615. \def\subtitle{\parsearg\subtitlezzz}%
  1616. \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  1617. %
  1618. % @author should come last, but may come many times.
  1619. \def\author{\parsearg\authorzzz}%
  1620. \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  1621. {\authorfont \leftline{##1}}}%
  1622. %
  1623. % Most title ``pages'' are actually two pages long, with space
  1624. % at the top of the second. We don't want the ragged left on the second.
  1625. \let\oldpage = \page
  1626. \def\page{%
  1627. \iffinishedtitlepage\else
  1628. \finishtitlepage
  1629. \fi
  1630. \oldpage
  1631. \let\page = \oldpage
  1632. \hbox{}}%
  1633. % \def\page{\oldpage \hbox{}}
  1634. }
  1635. \def\Etitlepage{%
  1636. \iffinishedtitlepage\else
  1637. \finishtitlepage
  1638. \fi
  1639. % It is important to do the page break before ending the group,
  1640. % because the headline and footline are only empty inside the group.
  1641. % If we use the new definition of \page, we always get a blank page
  1642. % after the title page, which we certainly don't want.
  1643. \oldpage
  1644. \endgroup
  1645. %
  1646. % Need this before the \...aftertitlepage checks so that if they are
  1647. % in effect the toc pages will come out with page numbers.
  1648. \HEADINGSon
  1649. %
  1650. % If they want short, they certainly want long too.
  1651. \ifsetshortcontentsaftertitlepage
  1652. \shortcontents
  1653. \contents
  1654. \global\let\shortcontents = \relax
  1655. \global\let\contents = \relax
  1656. \fi
  1657. %
  1658. \ifsetcontentsaftertitlepage
  1659. \contents
  1660. \global\let\contents = \relax
  1661. \global\let\shortcontents = \relax
  1662. \fi
  1663. }
  1664. \def\finishtitlepage{%
  1665. \vskip4pt \hrule height 2pt width \hsize
  1666. \vskip\titlepagebottomglue
  1667. \finishedtitlepagetrue
  1668. }
  1669. %%% Set up page headings and footings.
  1670. \let\thispage=\folio
  1671. \newtoks\evenheadline % headline on even pages
  1672. \newtoks\oddheadline % headline on odd pages
  1673. \newtoks\evenfootline % footline on even pages
  1674. \newtoks\oddfootline % footline on odd pages
  1675. % Now make Tex use those variables
  1676. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  1677. \else \the\evenheadline \fi}}
  1678. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  1679. \else \the\evenfootline \fi}\HEADINGShook}
  1680. \let\HEADINGShook=\relax
  1681. % Commands to set those variables.
  1682. % For example, this is what @headings on does
  1683. % @evenheading @thistitle|@thispage|@thischapter
  1684. % @oddheading @thischapter|@thispage|@thistitle
  1685. % @evenfooting @thisfile||
  1686. % @oddfooting ||@thisfile
  1687. \def\evenheading{\parsearg\evenheadingxxx}
  1688. \def\oddheading{\parsearg\oddheadingxxx}
  1689. \def\everyheading{\parsearg\everyheadingxxx}
  1690. \def\evenfooting{\parsearg\evenfootingxxx}
  1691. \def\oddfooting{\parsearg\oddfootingxxx}
  1692. \def\everyfooting{\parsearg\everyfootingxxx}
  1693. {\catcode`\@=0 %
  1694. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  1695. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  1696. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1697. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  1698. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  1699. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1700. \gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  1701. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1702. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1703. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1704. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1705. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1706. \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  1707. %
  1708. % Leave some space for the footline. Hopefully ok to assume
  1709. % @evenfooting will not be used by itself.
  1710. \global\advance\pageheight by -\baselineskip
  1711. \global\advance\vsize by -\baselineskip
  1712. }
  1713. \gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  1714. %
  1715. }% unbind the catcode of @.
  1716. % @headings double turns headings on for double-sided printing.
  1717. % @headings single turns headings on for single-sided printing.
  1718. % @headings off turns them off.
  1719. % @headings on same as @headings double, retained for compatibility.
  1720. % @headings after turns on double-sided headings after this page.
  1721. % @headings doubleafter turns on double-sided headings after this page.
  1722. % @headings singleafter turns on single-sided headings after this page.
  1723. % By default, they are off at the start of a document,
  1724. % and turned `on' after @end titlepage.
  1725. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1726. \def\HEADINGSoff{
  1727. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1728. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1729. \HEADINGSoff
  1730. % When we turn headings on, set the page number to 1.
  1731. % For double-sided printing, put current file name in lower left corner,
  1732. % chapter name on inside top of right hand pages, document
  1733. % title on inside top of left hand pages, and page numbers on outside top
  1734. % edge of all pages.
  1735. \def\HEADINGSdouble{
  1736. \global\pageno=1
  1737. \global\evenfootline={\hfil}
  1738. \global\oddfootline={\hfil}
  1739. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1740. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1741. \global\let\contentsalignmacro = \chapoddpage
  1742. }
  1743. \let\contentsalignmacro = \chappager
  1744. % For single-sided printing, chapter title goes across top left of page,
  1745. % page number on top right.
  1746. \def\HEADINGSsingle{
  1747. \global\pageno=1
  1748. \global\evenfootline={\hfil}
  1749. \global\oddfootline={\hfil}
  1750. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1751. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1752. \global\let\contentsalignmacro = \chappager
  1753. }
  1754. \def\HEADINGSon{\HEADINGSdouble}
  1755. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1756. \let\HEADINGSdoubleafter=\HEADINGSafter
  1757. \def\HEADINGSdoublex{%
  1758. \global\evenfootline={\hfil}
  1759. \global\oddfootline={\hfil}
  1760. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1761. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1762. \global\let\contentsalignmacro = \chapoddpage
  1763. }
  1764. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1765. \def\HEADINGSsinglex{%
  1766. \global\evenfootline={\hfil}
  1767. \global\oddfootline={\hfil}
  1768. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1769. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1770. \global\let\contentsalignmacro = \chappager
  1771. }
  1772. % Subroutines used in generating headings
  1773. % This produces Day Month Year style of output.
  1774. % Only define if not already defined, in case a txi-??.tex file has set
  1775. % up a different format (e.g., txi-cs.tex does this).
  1776. \ifx\today\undefined
  1777. \def\today{%
  1778. \number\day\space
  1779. \ifcase\month
  1780. \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  1781. \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  1782. \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  1783. \fi
  1784. \space\number\year}
  1785. \fi
  1786. % @settitle line... specifies the title of the document, for headings.
  1787. % It generates no output of its own.
  1788. \def\thistitle{\putwordNoTitle}
  1789. \def\settitle{\parsearg\settitlezzz}
  1790. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1791. \message{tables,}
  1792. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1793. % default indentation of table text
  1794. \newdimen\tableindent \tableindent=.8in
  1795. % default indentation of @itemize and @enumerate text
  1796. \newdimen\itemindent \itemindent=.3in
  1797. % margin between end of table item and start of table text.
  1798. \newdimen\itemmargin \itemmargin=.1in
  1799. % used internally for \itemindent minus \itemmargin
  1800. \newdimen\itemmax
  1801. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1802. % these defs.
  1803. % They also define \itemindex
  1804. % to index the item name in whatever manner is desired (perhaps none).
  1805. \newif\ifitemxneedsnegativevskip
  1806. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  1807. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1808. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1809. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1810. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1811. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1812. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1813. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1814. \itemzzz {#1}}
  1815. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1816. \itemzzz {#1}}
  1817. \def\itemzzz #1{\begingroup %
  1818. \advance\hsize by -\rightskip
  1819. \advance\hsize by -\tableindent
  1820. \setbox0=\hbox{\itemfont{#1}}%
  1821. \itemindex{#1}%
  1822. \nobreak % This prevents a break before @itemx.
  1823. %
  1824. % If the item text does not fit in the space we have, put it on a line
  1825. % by itself, and do not allow a page break either before or after that
  1826. % line. We do not start a paragraph here because then if the next
  1827. % command is, e.g., @kindex, the whatsit would get put into the
  1828. % horizontal list on a line by itself, resulting in extra blank space.
  1829. \ifdim \wd0>\itemmax
  1830. %
  1831. % Make this a paragraph so we get the \parskip glue and wrapping,
  1832. % but leave it ragged-right.
  1833. \begingroup
  1834. \advance\leftskip by-\tableindent
  1835. \advance\hsize by\tableindent
  1836. \advance\rightskip by0pt plus1fil
  1837. \leavevmode\unhbox0\par
  1838. \endgroup
  1839. %
  1840. % We're going to be starting a paragraph, but we don't want the
  1841. % \parskip glue -- logically it's part of the @item we just started.
  1842. \nobreak \vskip-\parskip
  1843. %
  1844. % Stop a page break at the \parskip glue coming up. (Unfortunately
  1845. % we can't prevent a possible page break at the following
  1846. % \baselineskip glue.) However, if what follows is an environment
  1847. % such as @example, there will be no \parskip glue; then
  1848. % the negative vskip we just would cause the example and the item to
  1849. % crash together. So we use this bizarre value of 10001 as a signal
  1850. % to \aboveenvbreak to insert \parskip glue after all.
  1851. % (Possibly there are other commands that could be followed by
  1852. % @example which need the same treatment, but not section titles; or
  1853. % maybe section titles are the only special case and they should be
  1854. % penalty 10001...)
  1855. \penalty 10001
  1856. \endgroup
  1857. \itemxneedsnegativevskipfalse
  1858. \else
  1859. % The item text fits into the space. Start a paragraph, so that the
  1860. % following text (if any) will end up on the same line.
  1861. \noindent
  1862. % Do this with kerns and \unhbox so that if there is a footnote in
  1863. % the item text, it can migrate to the main vertical list and
  1864. % eventually be printed.
  1865. \nobreak\kern-\tableindent
  1866. \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  1867. \unhbox0
  1868. \nobreak\kern\dimen0
  1869. \endgroup
  1870. \itemxneedsnegativevskiptrue
  1871. \fi
  1872. }
  1873. \def\item{\errmessage{@item while not in a table}}
  1874. \def\itemx{\errmessage{@itemx while not in a table}}
  1875. \def\kitem{\errmessage{@kitem while not in a table}}
  1876. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1877. \def\xitem{\errmessage{@xitem while not in a table}}
  1878. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1879. % Contains a kludge to get @end[description] to work.
  1880. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1881. % @table, @ftable, @vtable.
  1882. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1883. {\obeylines\obeyspaces%
  1884. \gdef\tablex #1^^M{%
  1885. \tabley\dontindex#1 \endtabley}}
  1886. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1887. {\obeylines\obeyspaces%
  1888. \gdef\ftablex #1^^M{%
  1889. \tabley\fnitemindex#1 \endtabley
  1890. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1891. \let\Etable=\relax}}
  1892. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1893. {\obeylines\obeyspaces%
  1894. \gdef\vtablex #1^^M{%
  1895. \tabley\vritemindex#1 \endtabley
  1896. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1897. \let\Etable=\relax}}
  1898. \def\dontindex #1{}
  1899. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1900. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1901. {\obeyspaces %
  1902. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1903. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1904. \def\tablez #1#2#3#4#5#6{%
  1905. \aboveenvbreak %
  1906. \begingroup %
  1907. \def\Edescription{\Etable}% Necessary kludge.
  1908. \let\itemindex=#1%
  1909. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1910. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1911. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1912. \def\itemfont{#2}%
  1913. \itemmax=\tableindent %
  1914. \advance \itemmax by -\itemmargin %
  1915. \advance \leftskip by \tableindent %
  1916. \exdentamount=\tableindent
  1917. \parindent = 0pt
  1918. \parskip = \smallskipamount
  1919. \ifdim \parskip=0pt \parskip=2pt \fi%
  1920. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1921. \let\item = \internalBitem %
  1922. \let\itemx = \internalBitemx %
  1923. \let\kitem = \internalBkitem %
  1924. \let\kitemx = \internalBkitemx %
  1925. \let\xitem = \internalBxitem %
  1926. \let\xitemx = \internalBxitemx %
  1927. }
  1928. % This is the counter used by @enumerate, which is really @itemize
  1929. \newcount \itemno
  1930. \def\itemize{\parsearg\itemizezzz}
  1931. \def\itemizezzz #1{%
  1932. \begingroup % ended by the @end itemize
  1933. \itemizey {#1}{\Eitemize}
  1934. }
  1935. \def\itemizey#1#2{%
  1936. \aboveenvbreak
  1937. \itemmax=\itemindent
  1938. \advance\itemmax by -\itemmargin
  1939. \advance\leftskip by \itemindent
  1940. \exdentamount=\itemindent
  1941. \parindent=0pt
  1942. \parskip=\smallskipamount
  1943. \ifdim\parskip=0pt \parskip=2pt \fi
  1944. \def#2{\endgraf\afterenvbreak\endgroup}%
  1945. \def\itemcontents{#1}%
  1946. % @itemize with no arg is equivalent to @itemize @bullet.
  1947. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  1948. \let\item=\itemizeitem
  1949. }
  1950. % \splitoff TOKENS\endmark defines \first to be the first token in
  1951. % TOKENS, and \rest to be the remainder.
  1952. %
  1953. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1954. % Allow an optional argument of an uppercase letter, lowercase letter,
  1955. % or number, to specify the first label in the enumerated list. No
  1956. % argument is the same as `1'.
  1957. %
  1958. \def\enumerate{\parsearg\enumeratezzz}
  1959. \def\enumeratezzz #1{\enumeratey #1 \endenumeratey}
  1960. \def\enumeratey #1 #2\endenumeratey{%
  1961. \begingroup % ended by the @end enumerate
  1962. %
  1963. % If we were given no argument, pretend we were given `1'.
  1964. \def\thearg{#1}%
  1965. \ifx\thearg\empty \def\thearg{1}\fi
  1966. %
  1967. % Detect if the argument is a single token. If so, it might be a
  1968. % letter. Otherwise, the only valid thing it can be is a number.
  1969. % (We will always have one token, because of the test we just made.
  1970. % This is a good thing, since \splitoff doesn't work given nothing at
  1971. % all -- the first parameter is undelimited.)
  1972. \expandafter\splitoff\thearg\endmark
  1973. \ifx\rest\empty
  1974. % Only one token in the argument. It could still be anything.
  1975. % A ``lowercase letter'' is one whose \lccode is nonzero.
  1976. % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1977. % not equal to itself.
  1978. % Otherwise, we assume it's a number.
  1979. %
  1980. % We need the \relax at the end of the \ifnum lines to stop TeX from
  1981. % continuing to look for a <number>.
  1982. %
  1983. \ifnum\lccode\expandafter`\thearg=0\relax
  1984. \numericenumerate % a number (we hope)
  1985. \else
  1986. % It's a letter.
  1987. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1988. \lowercaseenumerate % lowercase letter
  1989. \else
  1990. \uppercaseenumerate % uppercase letter
  1991. \fi
  1992. \fi
  1993. \else
  1994. % Multiple tokens in the argument. We hope it's a number.
  1995. \numericenumerate
  1996. \fi
  1997. }
  1998. % An @enumerate whose labels are integers. The starting integer is
  1999. % given in \thearg.
  2000. %
  2001. \def\numericenumerate{%
  2002. \itemno = \thearg
  2003. \startenumeration{\the\itemno}%
  2004. }
  2005. % The starting (lowercase) letter is in \thearg.
  2006. \def\lowercaseenumerate{%
  2007. \itemno = \expandafter`\thearg
  2008. \startenumeration{%
  2009. % Be sure we're not beyond the end of the alphabet.
  2010. \ifnum\itemno=0
  2011. \errmessage{No more lowercase letters in @enumerate; get a bigger
  2012. alphabet}%
  2013. \fi
  2014. \char\lccode\itemno
  2015. }%
  2016. }
  2017. % The starting (uppercase) letter is in \thearg.
  2018. \def\uppercaseenumerate{%
  2019. \itemno = \expandafter`\thearg
  2020. \startenumeration{%
  2021. % Be sure we're not beyond the end of the alphabet.
  2022. \ifnum\itemno=0
  2023. \errmessage{No more uppercase letters in @enumerate; get a bigger
  2024. alphabet}
  2025. \fi
  2026. \char\uccode\itemno
  2027. }%
  2028. }
  2029. % Call itemizey, adding a period to the first argument and supplying the
  2030. % common last two arguments. Also subtract one from the initial value in
  2031. % \itemno, since @item increments \itemno.
  2032. %
  2033. \def\startenumeration#1{%
  2034. \advance\itemno by -1
  2035. \itemizey{#1.}\Eenumerate\flushcr
  2036. }
  2037. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  2038. % to @enumerate.
  2039. %
  2040. \def\alphaenumerate{\enumerate{a}}
  2041. \def\capsenumerate{\enumerate{A}}
  2042. \def\Ealphaenumerate{\Eenumerate}
  2043. \def\Ecapsenumerate{\Eenumerate}
  2044. % Definition of @item while inside @itemize.
  2045. \def\itemizeitem{%
  2046. \advance\itemno by 1
  2047. {\let\par=\endgraf \smallbreak}%
  2048. \ifhmode \errmessage{In hmode at itemizeitem}\fi
  2049. {\parskip=0in \hskip 0pt
  2050. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  2051. \vadjust{\penalty 1200}}%
  2052. \flushcr}
  2053. % @multitable macros
  2054. % Amy Hendrickson, 8/18/94, 3/6/96
  2055. %
  2056. % @multitable ... @end multitable will make as many columns as desired.
  2057. % Contents of each column will wrap at width given in preamble. Width
  2058. % can be specified either with sample text given in a template line,
  2059. % or in percent of \hsize, the current width of text on page.
  2060. % Table can continue over pages but will only break between lines.
  2061. % To make preamble:
  2062. %
  2063. % Either define widths of columns in terms of percent of \hsize:
  2064. % @multitable @columnfractions .25 .3 .45
  2065. % @item ...
  2066. %
  2067. % Numbers following @columnfractions are the percent of the total
  2068. % current hsize to be used for each column. You may use as many
  2069. % columns as desired.
  2070. % Or use a template:
  2071. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  2072. % @item ...
  2073. % using the widest term desired in each column.
  2074. %
  2075. % For those who want to use more than one line's worth of words in
  2076. % the preamble, break the line within one argument and it
  2077. % will parse correctly, i.e.,
  2078. %
  2079. % @multitable {Column 1 template} {Column 2 template} {Column 3
  2080. % template}
  2081. % Not:
  2082. % @multitable {Column 1 template} {Column 2 template}
  2083. % {Column 3 template}
  2084. % Each new table line starts with @item, each subsequent new column
  2085. % starts with @tab. Empty columns may be produced by supplying @tab's
  2086. % with nothing between them for as many times as empty columns are needed,
  2087. % ie, @tab@tab@tab will produce two empty columns.
  2088. % @item, @tab, @multitable or @end multitable do not need to be on their
  2089. % own lines, but it will not hurt if they are.
  2090. % Sample multitable:
  2091. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  2092. % @item first col stuff @tab second col stuff @tab third col
  2093. % @item
  2094. % first col stuff
  2095. % @tab
  2096. % second col stuff
  2097. % @tab
  2098. % third col
  2099. % @item first col stuff @tab second col stuff
  2100. % @tab Many paragraphs of text may be used in any column.
  2101. %
  2102. % They will wrap at the width determined by the template.
  2103. % @item@tab@tab This will be in third column.
  2104. % @end multitable
  2105. % Default dimensions may be reset by user.
  2106. % @multitableparskip is vertical space between paragraphs in table.
  2107. % @multitableparindent is paragraph indent in table.
  2108. % @multitablecolmargin is horizontal space to be left between columns.
  2109. % @multitablelinespace is space to leave between table items, baseline
  2110. % to baseline.
  2111. % 0pt means it depends on current normal line spacing.
  2112. %
  2113. \newskip\multitableparskip
  2114. \newskip\multitableparindent
  2115. \newdimen\multitablecolspace
  2116. \newskip\multitablelinespace
  2117. \multitableparskip=0pt
  2118. \multitableparindent=6pt
  2119. \multitablecolspace=12pt
  2120. \multitablelinespace=0pt
  2121. % Macros used to set up halign preamble:
  2122. %
  2123. \let\endsetuptable\relax
  2124. \def\xendsetuptable{\endsetuptable}
  2125. \let\columnfractions\relax
  2126. \def\xcolumnfractions{\columnfractions}
  2127. \newif\ifsetpercent
  2128. % #1 is the part of the @columnfraction before the decimal point, which
  2129. % is presumably either 0 or the empty string (but we don't check, we
  2130. % just throw it away). #2 is the decimal part, which we use as the
  2131. % percent of \hsize for this column.
  2132. \def\pickupwholefraction#1.#2 {%
  2133. \global\advance\colcount by 1
  2134. \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}%
  2135. \setuptable
  2136. }
  2137. \newcount\colcount
  2138. \def\setuptable#1{%
  2139. \def\firstarg{#1}%
  2140. \ifx\firstarg\xendsetuptable
  2141. \let\go = \relax
  2142. \else
  2143. \ifx\firstarg\xcolumnfractions
  2144. \global\setpercenttrue
  2145. \else
  2146. \ifsetpercent
  2147. \let\go\pickupwholefraction
  2148. \else
  2149. \global\advance\colcount by 1
  2150. \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  2151. % separator; typically that is always in the input, anyway.
  2152. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  2153. \fi
  2154. \fi
  2155. \ifx\go\pickupwholefraction
  2156. % Put the argument back for the \pickupwholefraction call, so
  2157. % we'll always have a period there to be parsed.
  2158. \def\go{\pickupwholefraction#1}%
  2159. \else
  2160. \let\go = \setuptable
  2161. \fi%
  2162. \fi
  2163. \go
  2164. }
  2165. % @multitable ... @end multitable definitions:
  2166. %
  2167. \def\multitable{\parsearg\dotable}
  2168. \def\dotable#1{\bgroup
  2169. \vskip\parskip
  2170. \let\item=\crcrwithfootnotes
  2171. % A \tab used to include \hskip1sp. But then the space in a template
  2172. % line is not enough. That is bad. So let's go back to just & until
  2173. % we encounter the problem it was intended to solve again. --karl,
  2174. % nathan@acm.org, 20apr99.
  2175. \let\tab=&%
  2176. \let\startfootins=\startsavedfootnote
  2177. \tolerance=9500
  2178. \hbadness=9500
  2179. \setmultitablespacing
  2180. \parskip=\multitableparskip
  2181. \parindent=\multitableparindent
  2182. \overfullrule=0pt
  2183. \global\colcount=0
  2184. \def\Emultitable{%
  2185. \global\setpercentfalse
  2186. \crcrwithfootnotes\crcr
  2187. \egroup\egroup
  2188. }%
  2189. %
  2190. % To parse everything between @multitable and @item:
  2191. \setuptable#1 \endsetuptable
  2192. %
  2193. % \everycr will reset column counter, \colcount, at the end of
  2194. % each line. Every column entry will cause \colcount to advance by one.
  2195. % The table preamble
  2196. % looks at the current \colcount to find the correct column width.
  2197. \everycr{\noalign{%
  2198. %
  2199. % \filbreak%% keeps underfull box messages off when table breaks over pages.
  2200. % Maybe so, but it also creates really weird page breaks when the table
  2201. % breaks over pages. Wouldn't \vfil be better? Wait until the problem
  2202. % manifests itself, so it can be fixed for real --karl.
  2203. \global\colcount=0\relax}}%
  2204. %
  2205. % This preamble sets up a generic column definition, which will
  2206. % be used as many times as user calls for columns.
  2207. % \vtop will set a single line and will also let text wrap and
  2208. % continue for many paragraphs if desired.
  2209. \halign\bgroup&\global\advance\colcount by 1\relax
  2210. \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
  2211. %
  2212. % In order to keep entries from bumping into each other
  2213. % we will add a \leftskip of \multitablecolspace to all columns after
  2214. % the first one.
  2215. %
  2216. % If a template has been used, we will add \multitablecolspace
  2217. % to the width of each template entry.
  2218. %
  2219. % If the user has set preamble in terms of percent of \hsize we will
  2220. % use that dimension as the width of the column, and the \leftskip
  2221. % will keep entries from bumping into each other. Table will start at
  2222. % left margin and final column will justify at right margin.
  2223. %
  2224. % Make sure we don't inherit \rightskip from the outer environment.
  2225. \rightskip=0pt
  2226. \ifnum\colcount=1
  2227. % The first column will be indented with the surrounding text.
  2228. \advance\hsize by\leftskip
  2229. \else
  2230. \ifsetpercent \else
  2231. % If user has not set preamble in terms of percent of \hsize
  2232. % we will advance \hsize by \multitablecolspace.
  2233. \advance\hsize by \multitablecolspace
  2234. \fi
  2235. % In either case we will make \leftskip=\multitablecolspace:
  2236. \leftskip=\multitablecolspace
  2237. \fi
  2238. % Ignoring space at the beginning and end avoids an occasional spurious
  2239. % blank line, when TeX decides to break the line at the space before the
  2240. % box from the multistrut, so the strut ends up on a line by itself.
  2241. % For example:
  2242. % @multitable @columnfractions .11 .89
  2243. % @item @code{#}
  2244. % @tab Legal holiday which is valid in major parts of the whole country.
  2245. % Is automatically provided with highlighting sequences respectively marking
  2246. % characters.
  2247. \noindent\ignorespaces##\unskip\multistrut}\cr
  2248. }
  2249. \def\setmultitablespacing{% test to see if user has set \multitablelinespace.
  2250. % If so, do nothing. If not, give it an appropriate dimension based on
  2251. % current baselineskip.
  2252. \ifdim\multitablelinespace=0pt
  2253. \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  2254. \global\advance\multitablelinespace by-\ht0
  2255. %% strut to put in table in case some entry doesn't have descenders,
  2256. %% to keep lines equally spaced
  2257. \let\multistrut = \strut
  2258. \else
  2259. %% FIXME: what is \box0 supposed to be?
  2260. \gdef\multistrut{\vrule height\multitablelinespace depth\dp0
  2261. width0pt\relax} \fi
  2262. %% Test to see if parskip is larger than space between lines of
  2263. %% table. If not, do nothing.
  2264. %% If so, set to same dimension as multitablelinespace.
  2265. \ifdim\multitableparskip>\multitablelinespace
  2266. \global\multitableparskip=\multitablelinespace
  2267. \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  2268. %% than skip between lines in the table.
  2269. \fi%
  2270. \ifdim\multitableparskip=0pt
  2271. \global\multitableparskip=\multitablelinespace
  2272. \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller
  2273. %% than skip between lines in the table.
  2274. \fi}
  2275. % In case a @footnote appears inside an alignment, save the footnote
  2276. % text to a box and make the \insert when a row of the table is
  2277. % finished. Otherwise, the insertion is lost, it never migrates to the
  2278. % main vertical list. --kasal, 22jan03.
  2279. %
  2280. \newbox\savedfootnotes
  2281. %
  2282. % \dotable \let's \startfootins to this, so that \dofootnote will call
  2283. % it instead of starting the insertion right away.
  2284. \def\startsavedfootnote{%
  2285. \global\setbox\savedfootnotes = \vbox\bgroup
  2286. \unvbox\savedfootnotes
  2287. }
  2288. \def\crcrwithfootnotes{%
  2289. \crcr
  2290. \ifvoid\savedfootnotes \else
  2291. \noalign{\insert\footins{\box\savedfootnotes}}%
  2292. \fi
  2293. }
  2294. \message{conditionals,}
  2295. % Prevent errors for section commands.
  2296. % Used in @ignore and in failing conditionals.
  2297. \def\ignoresections{%
  2298. \let\chapter=\relax
  2299. \let\unnumbered=\relax
  2300. \let\top=\relax
  2301. \let\unnumberedsec=\relax
  2302. \let\unnumberedsection=\relax
  2303. \let\unnumberedsubsec=\relax
  2304. \let\unnumberedsubsection=\relax
  2305. \let\unnumberedsubsubsec=\relax
  2306. \let\unnumberedsubsubsection=\relax
  2307. \let\section=\relax
  2308. \let\subsec=\relax
  2309. \let\subsubsec=\relax
  2310. \let\subsection=\relax
  2311. \let\subsubsection=\relax
  2312. \let\appendix=\relax
  2313. \let\appendixsec=\relax
  2314. \let\appendixsection=\relax
  2315. \let\appendixsubsec=\relax
  2316. \let\appendixsubsection=\relax
  2317. \let\appendixsubsubsec=\relax
  2318. \let\appendixsubsubsection=\relax
  2319. \let\contents=\relax
  2320. \let\smallbook=\relax
  2321. \let\titlepage=\relax
  2322. }
  2323. % Used in nested conditionals, where we have to parse the Texinfo source
  2324. % and so want to turn off most commands, in case they are used
  2325. % incorrectly.
  2326. %
  2327. % We use \empty instead of \relax for the @def... commands, so that \end
  2328. % doesn't throw an error. For instance:
  2329. % @ignore
  2330. % @deffn ...
  2331. % @end deffn
  2332. % @end ignore
  2333. %
  2334. % The @end deffn is going to get expanded, because we're trying to allow
  2335. % nested conditionals. But we don't want to expand the actual @deffn,
  2336. % since it might be syntactically correct and intended to be ignored.
  2337. % Since \end checks for \relax, using \empty does not cause an error.
  2338. %
  2339. \def\ignoremorecommands{%
  2340. \let\defcodeindex = \relax
  2341. \let\defcv = \empty
  2342. \let\defcvx = \empty
  2343. \let\Edefcv = \empty
  2344. \let\deffn = \empty
  2345. \let\deffnx = \empty
  2346. \let\Edeffn = \empty
  2347. \let\defindex = \relax
  2348. \let\defivar = \empty
  2349. \let\defivarx = \empty
  2350. \let\Edefivar = \empty
  2351. \let\defmac = \empty
  2352. \let\defmacx = \empty
  2353. \let\Edefmac = \empty
  2354. \let\defmethod = \empty
  2355. \let\defmethodx = \empty
  2356. \let\Edefmethod = \empty
  2357. \let\defop = \empty
  2358. \let\defopx = \empty
  2359. \let\Edefop = \empty
  2360. \let\defopt = \empty
  2361. \let\defoptx = \empty
  2362. \let\Edefopt = \empty
  2363. \let\defspec = \empty
  2364. \let\defspecx = \empty
  2365. \let\Edefspec = \empty
  2366. \let\deftp = \empty
  2367. \let\deftpx = \empty
  2368. \let\Edeftp = \empty
  2369. \let\deftypefn = \empty
  2370. \let\deftypefnx = \empty
  2371. \let\Edeftypefn = \empty
  2372. \let\deftypefun = \empty
  2373. \let\deftypefunx = \empty
  2374. \let\Edeftypefun = \empty
  2375. \let\deftypeivar = \empty
  2376. \let\deftypeivarx = \empty
  2377. \let\Edeftypeivar = \empty
  2378. \let\deftypemethod = \empty
  2379. \let\deftypemethodx = \empty
  2380. \let\Edeftypemethod = \empty
  2381. \let\deftypeop = \empty
  2382. \let\deftypeopx = \empty
  2383. \let\Edeftypeop = \empty
  2384. \let\deftypevar = \empty
  2385. \let\deftypevarx = \empty
  2386. \let\Edeftypevar = \empty
  2387. \let\deftypevr = \empty
  2388. \let\deftypevrx = \empty
  2389. \let\Edeftypevr = \empty
  2390. \let\defun = \empty
  2391. \let\defunx = \empty
  2392. \let\Edefun = \empty
  2393. \let\defvar = \empty
  2394. \let\defvarx = \empty
  2395. \let\Edefvar = \empty
  2396. \let\defvr = \empty
  2397. \let\defvrx = \empty
  2398. \let\Edefvr = \empty
  2399. \let\clear = \relax
  2400. \let\down = \relax
  2401. \let\evenfooting = \relax
  2402. \let\evenheading = \relax
  2403. \let\everyfooting = \relax
  2404. \let\everyheading = \relax
  2405. \let\headings = \relax
  2406. \let\include = \relax
  2407. \let\item = \relax
  2408. \let\lowersections = \relax
  2409. \let\oddfooting = \relax
  2410. \let\oddheading = \relax
  2411. \let\printindex = \relax
  2412. \let\pxref = \relax
  2413. \let\raisesections = \relax
  2414. \let\ref = \relax
  2415. \let\set = \relax
  2416. \let\setchapternewpage = \relax
  2417. \let\setchapterstyle = \relax
  2418. \let\settitle = \relax
  2419. \let\up = \relax
  2420. \let\verbatiminclude = \relax
  2421. \let\xref = \relax
  2422. }
  2423. % Ignore @ignore, @ifhtml, @ifinfo, and the like.
  2424. %
  2425. \def\direntry{\doignore{direntry}}
  2426. \def\documentdescriptionword{documentdescription}
  2427. \def\documentdescription{\doignore{documentdescription}}
  2428. \def\html{\doignore{html}}
  2429. \def\ifhtml{\doignore{ifhtml}}
  2430. \def\ifinfo{\doignore{ifinfo}}
  2431. \def\ifnottex{\doignore{ifnottex}}
  2432. \def\ifplaintext{\doignore{ifplaintext}}
  2433. \def\ifxml{\doignore{ifxml}}
  2434. \def\ignore{\doignore{ignore}}
  2435. \def\menu{\doignore{menu}}
  2436. \def\xml{\doignore{xml}}
  2437. % @dircategory CATEGORY -- specify a category of the dir file
  2438. % which this file should belong to. Ignore this in TeX.
  2439. \let\dircategory = \comment
  2440. % Ignore text until a line `@end #1'.
  2441. %
  2442. \def\doignore#1{\begingroup
  2443. % Don't complain about control sequences we have declared \outer.
  2444. \ignoresections
  2445. %
  2446. % Define a command to swallow text until we reach `@end #1'.
  2447. % This @ is a catcode 12 token (that is the normal catcode of @ in
  2448. % this texinfo.tex file). We change the catcode of @ below to match.
  2449. \long\def\doignoretext##1@end #1{\enddoignore}%
  2450. %
  2451. % Make sure that spaces turn into tokens that match what \doignoretext wants.
  2452. \catcode\spaceChar = 10
  2453. %
  2454. % Ignore braces, too, so mismatched braces don't cause trouble.
  2455. \catcode`\{ = 9
  2456. \catcode`\} = 9
  2457. %
  2458. % We must not have @c interpreted as a control sequence.
  2459. \catcode`\@ = 12
  2460. %
  2461. \def\ignoreword{#1}%
  2462. \ifx\ignoreword\documentdescriptionword
  2463. % The c kludge breaks documentdescription, since
  2464. % `documentdescription' contains a `c'. Means not everything will
  2465. % be ignored inside @documentdescription, but oh well...
  2466. \else
  2467. % Make the letter c a comment character so that the rest of the line
  2468. % will be ignored. This way, the document can have (for example)
  2469. % @c @end ifinfo
  2470. % and the @end ifinfo will be properly ignored.
  2471. % (We've just changed @ to catcode 12.)
  2472. \catcode`\c = 14
  2473. \fi
  2474. %
  2475. % And now expand the command defined above.
  2476. \doignoretext
  2477. }
  2478. % What we do to finish off ignored text.
  2479. %
  2480. \def\enddoignore{\endgroup\ignorespaces}%
  2481. \newif\ifwarnedobs\warnedobsfalse
  2482. \def\obstexwarn{%
  2483. \ifwarnedobs\relax\else
  2484. % We need to warn folks that they may have trouble with TeX 3.0.
  2485. % This uses \immediate\write16 rather than \message to get newlines.
  2486. \immediate\write16{}
  2487. \immediate\write16{WARNING: for users of Unix TeX 3.0!}
  2488. \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  2489. \immediate\write16{If you are running another version of TeX, relax.}
  2490. \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  2491. \immediate\write16{ Then upgrade your TeX installation if you can.}
  2492. \immediate\write16{ (See ftp://ftp.gnu.org/non-gnu/TeX.README.)}
  2493. \immediate\write16{If you are stuck with version 3.0, run the}
  2494. \immediate\write16{ script ``tex3patch'' from the Texinfo distribution}
  2495. \immediate\write16{ to use a workaround.}
  2496. \immediate\write16{}
  2497. \global\warnedobstrue
  2498. \fi
  2499. }
  2500. % **In TeX 3.0, setting text in \nullfont hangs tex. For a
  2501. % workaround (which requires the file ``dummy.tfm'' to be installed),
  2502. % uncomment the following line:
  2503. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  2504. % Ignore text, except that we keep track of conditional commands for
  2505. % purposes of nesting, up to an `@end #1' command.
  2506. %
  2507. \def\nestedignore#1{%
  2508. \obstexwarn
  2509. % We must actually expand the ignored text to look for the @end
  2510. % command, so that nested ignore constructs work. Thus, we put the
  2511. % text into a \vbox and then do nothing with the result. To minimize
  2512. % the chance of memory overflow, we follow the approach outlined on
  2513. % page 401 of the TeXbook.
  2514. %
  2515. \setbox0 = \vbox\bgroup
  2516. % Don't complain about control sequences we have declared \outer.
  2517. \ignoresections
  2518. %
  2519. % Define `@end #1' to end the box, which will in turn undefine the
  2520. % @end command again.
  2521. \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  2522. %
  2523. % We are going to be parsing Texinfo commands. Most cause no
  2524. % trouble when they are used incorrectly, but some commands do
  2525. % complicated argument parsing or otherwise get confused, so we
  2526. % undefine them.
  2527. %
  2528. % We can't do anything about stray @-signs, unfortunately;
  2529. % they'll produce `undefined control sequence' errors.
  2530. \ignoremorecommands
  2531. %
  2532. % Set the current font to be \nullfont, a TeX primitive, and define
  2533. % all the font commands to also use \nullfont. We don't use
  2534. % dummy.tfm, as suggested in the TeXbook, because some sites
  2535. % might not have that installed. Therefore, math mode will still
  2536. % produce output, but that should be an extremely small amount of
  2537. % stuff compared to the main input.
  2538. %
  2539. \nullfont
  2540. \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont
  2541. \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont
  2542. \let\tensf=\nullfont
  2543. % Similarly for index fonts.
  2544. \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont
  2545. \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont
  2546. \let\smallsf=\nullfont
  2547. % Similarly for smallexample fonts.
  2548. \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont
  2549. \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont
  2550. \let\smallersf=\nullfont
  2551. %
  2552. % Don't complain when characters are missing from the fonts.
  2553. \tracinglostchars = 0
  2554. %
  2555. % Don't bother to do space factor calculations.
  2556. \frenchspacing
  2557. %
  2558. % Don't report underfull hboxes.
  2559. \hbadness = 10000
  2560. %
  2561. % Do minimal line-breaking.
  2562. \pretolerance = 10000
  2563. %
  2564. % Do not execute instructions in @tex.
  2565. \def\tex{\doignore{tex}}%
  2566. % Do not execute macro definitions.
  2567. % `c' is a comment character, so the word `macro' will get cut off.
  2568. \def\macro{\doignore{ma}}%
  2569. }
  2570. % @set VAR sets the variable VAR to an empty value.
  2571. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  2572. %
  2573. % Since we want to separate VAR from REST-OF-LINE (which might be
  2574. % empty), we can't just use \parsearg; we have to insert a space of our
  2575. % own to delimit the rest of the line, and then take it out again if we
  2576. % didn't need it. Make sure the catcode of space is correct to avoid
  2577. % losing inside @example, for instance.
  2578. %
  2579. \def\set{\begingroup\catcode` =10
  2580. \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR.
  2581. \parsearg\setxxx}
  2582. \def\setxxx#1{\setyyy#1 \endsetyyy}
  2583. \def\setyyy#1 #2\endsetyyy{%
  2584. \def\temp{#2}%
  2585. \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  2586. \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  2587. \fi
  2588. \endgroup
  2589. }
  2590. % Can't use \xdef to pre-expand #2 and save some time, since \temp or
  2591. % \next or other control sequences that we've defined might get us into
  2592. % an infinite loop. Consider `@set foo @cite{bar}'.
  2593. \def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}}
  2594. % @clear VAR clears (i.e., unsets) the variable VAR.
  2595. %
  2596. \def\clear{\parsearg\clearxxx}
  2597. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  2598. % @value{foo} gets the text saved in variable foo.
  2599. {
  2600. \catcode`\_ = \active
  2601. %
  2602. % We might end up with active _ or - characters in the argument if
  2603. % we're called from @code, as @code{@value{foo-bar_}}. So \let any
  2604. % such active characters to their normal equivalents.
  2605. \gdef\value{\begingroup
  2606. \catcode`\-=\other \catcode`\_=\other
  2607. \indexbreaks \let_\normalunderscore
  2608. \valuexxx}
  2609. }
  2610. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  2611. % We have this subroutine so that we can handle at least some @value's
  2612. % properly in indexes (we \let\value to this in \indexdummies). Ones
  2613. % whose names contain - or _ still won't work, but we can't do anything
  2614. % about that. The command has to be fully expandable (if the variable
  2615. % is set), since the result winds up in the index file. This means that
  2616. % if the variable's value contains other Texinfo commands, it's almost
  2617. % certain it will fail (although perhaps we could fix that with
  2618. % sufficient work to do a one-level expansion on the result, instead of
  2619. % complete).
  2620. %
  2621. \def\expandablevalue#1{%
  2622. \expandafter\ifx\csname SET#1\endcsname\relax
  2623. {[No value for ``#1'']}%
  2624. \message{Variable `#1', used in @value, is not set.}%
  2625. \else
  2626. \csname SET#1\endcsname
  2627. \fi
  2628. }
  2629. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  2630. % with @set.
  2631. %
  2632. \def\ifset{\parsearg\doifset}
  2633. \def\doifset#1{%
  2634. \expandafter\ifx\csname SET#1\endcsname\relax
  2635. \let\next=\ifsetfail
  2636. \else
  2637. \let\next=\ifsetsucceed
  2638. \fi
  2639. \next
  2640. }
  2641. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  2642. \def\ifsetfail{\nestedignore{ifset}}
  2643. \defineunmatchedend{ifset}
  2644. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  2645. % defined with @set, or has been undefined with @clear.
  2646. %
  2647. \def\ifclear{\parsearg\doifclear}
  2648. \def\doifclear#1{%
  2649. \expandafter\ifx\csname SET#1\endcsname\relax
  2650. \let\next=\ifclearsucceed
  2651. \else
  2652. \let\next=\ifclearfail
  2653. \fi
  2654. \next
  2655. }
  2656. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  2657. \def\ifclearfail{\nestedignore{ifclear}}
  2658. \defineunmatchedend{ifclear}
  2659. % @iftex, @ifnothtml, @ifnotinfo, @ifnotplaintext always succeed; we
  2660. % read the text following, through the first @end iftex (etc.). Make
  2661. % `@end iftex' (etc.) valid only after an @iftex.
  2662. %
  2663. \def\iftex{\conditionalsucceed{iftex}}
  2664. \def\ifnothtml{\conditionalsucceed{ifnothtml}}
  2665. \def\ifnotinfo{\conditionalsucceed{ifnotinfo}}
  2666. \def\ifnotplaintext{\conditionalsucceed{ifnotplaintext}}
  2667. \defineunmatchedend{iftex}
  2668. \defineunmatchedend{ifnothtml}
  2669. \defineunmatchedend{ifnotinfo}
  2670. \defineunmatchedend{ifnotplaintext}
  2671. % True conditional. Since \set globally defines its variables, we can
  2672. % just start and end a group (to keep the @end definition undefined at
  2673. % the outer level).
  2674. %
  2675. \def\conditionalsucceed#1{\begingroup
  2676. \expandafter\def\csname E#1\endcsname{\endgroup}%
  2677. }
  2678. % @defininfoenclose.
  2679. \let\definfoenclose=\comment
  2680. \message{indexing,}
  2681. % Index generation facilities
  2682. % Define \newwrite to be identical to plain tex's \newwrite
  2683. % except not \outer, so it can be used within \newindex.
  2684. {\catcode`\@=11
  2685. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  2686. % \newindex {foo} defines an index named foo.
  2687. % It automatically defines \fooindex such that
  2688. % \fooindex ...rest of line... puts an entry in the index foo.
  2689. % It also defines \fooindfile to be the number of the output channel for
  2690. % the file that accumulates this index. The file's extension is foo.
  2691. % The name of an index should be no more than 2 characters long
  2692. % for the sake of vms.
  2693. %
  2694. \def\newindex#1{%
  2695. \iflinks
  2696. \expandafter\newwrite \csname#1indfile\endcsname
  2697. \openout \csname#1indfile\endcsname \jobname.#1 % Open the file
  2698. \fi
  2699. \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
  2700. \noexpand\doindex{#1}}
  2701. }
  2702. % @defindex foo == \newindex{foo}
  2703. %
  2704. \def\defindex{\parsearg\newindex}
  2705. % Define @defcodeindex, like @defindex except put all entries in @code.
  2706. %
  2707. \def\defcodeindex{\parsearg\newcodeindex}
  2708. %
  2709. \def\newcodeindex#1{%
  2710. \iflinks
  2711. \expandafter\newwrite \csname#1indfile\endcsname
  2712. \openout \csname#1indfile\endcsname \jobname.#1
  2713. \fi
  2714. \expandafter\xdef\csname#1index\endcsname{%
  2715. \noexpand\docodeindex{#1}}%
  2716. }
  2717. % @synindex foo bar makes index foo feed into index bar.
  2718. % Do this instead of @defindex foo if you don't want it as a separate index.
  2719. %
  2720. % @syncodeindex foo bar similar, but put all entries made for index foo
  2721. % inside @code.
  2722. %
  2723. \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  2724. \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  2725. % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  2726. % #3 the target index (bar).
  2727. \def\dosynindex#1#2#3{%
  2728. % Only do \closeout if we haven't already done it, else we'll end up
  2729. % closing the target index.
  2730. \expandafter \ifx\csname donesynindex#2\endcsname \undefined
  2731. % The \closeout helps reduce unnecessary open files; the limit on the
  2732. % Acorn RISC OS is a mere 16 files.
  2733. \expandafter\closeout\csname#2indfile\endcsname
  2734. \expandafter\let\csname\donesynindex#2\endcsname = 1
  2735. \fi
  2736. % redefine \fooindfile:
  2737. \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  2738. \expandafter\let\csname#2indfile\endcsname=\temp
  2739. % redefine \fooindex:
  2740. \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  2741. }
  2742. % Define \doindex, the driver for all \fooindex macros.
  2743. % Argument #1 is generated by the calling \fooindex macro,
  2744. % and it is "foo", the name of the index.
  2745. % \doindex just uses \parsearg; it calls \doind for the actual work.
  2746. % This is because \doind is more useful to call from other macros.
  2747. % There is also \dosubind {index}{topic}{subtopic}
  2748. % which makes an entry in a two-level index such as the operation index.
  2749. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  2750. \def\singleindexer #1{\doind{\indexname}{#1}}
  2751. % like the previous two, but they put @code around the argument.
  2752. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  2753. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  2754. % Take care of Texinfo commands that can appear in an index entry.
  2755. % Since there are some commands we want to expand, and others we don't,
  2756. % we have to laboriously prevent expansion for those that we don't.
  2757. %
  2758. \def\indexdummies{%
  2759. \def\@{@}% change to @@ when we switch to @ as escape char in index files.
  2760. \def\ {\realbackslash\space }%
  2761. % Need these in case \tex is in effect and \{ is a \delimiter again.
  2762. % But can't use \lbracecmd and \rbracecmd because texindex assumes
  2763. % braces and backslashes are used only as delimiters.
  2764. \let\{ = \mylbrace
  2765. \let\} = \myrbrace
  2766. %
  2767. % \definedummyword defines \#1 as \realbackslash #1\space, thus
  2768. % effectively preventing its expansion. This is used only for control
  2769. % words, not control letters, because the \space would be incorrect
  2770. % for control characters, but is needed to separate the control word
  2771. % from whatever follows.
  2772. %
  2773. % For control letters, we have \definedummyletter, which omits the
  2774. % space.
  2775. %
  2776. % These can be used both for control words that take an argument and
  2777. % those that do not. If it is followed by {arg} in the input, then
  2778. % that will dutifully get written to the index (or wherever).
  2779. %
  2780. \def\definedummyword##1{%
  2781. \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}%
  2782. }%
  2783. \def\definedummyletter##1{%
  2784. \expandafter\def\csname ##1\endcsname{\realbackslash ##1}%
  2785. }%
  2786. %
  2787. % Do the redefinitions.
  2788. \commondummies
  2789. }
  2790. % For the aux file, @ is the escape character. So we want to redefine
  2791. % everything using @ instead of \realbackslash. When everything uses
  2792. % @, this will be simpler.
  2793. %
  2794. \def\atdummies{%
  2795. \def\@{@@}%
  2796. \def\ {@ }%
  2797. \let\{ = \lbraceatcmd
  2798. \let\} = \rbraceatcmd
  2799. %
  2800. % (See comments in \indexdummies.)
  2801. \def\definedummyword##1{%
  2802. \expandafter\def\csname ##1\endcsname{@##1\space}%
  2803. }%
  2804. \def\definedummyletter##1{%
  2805. \expandafter\def\csname ##1\endcsname{@##1}%
  2806. }%
  2807. %
  2808. % Do the redefinitions.
  2809. \commondummies
  2810. }
  2811. % Called from \indexdummies and \atdummies. \definedummyword and
  2812. % \definedummyletter must be defined first.
  2813. %
  2814. \def\commondummies{%
  2815. %
  2816. \normalturnoffactive
  2817. %
  2818. % Control letters and accents.
  2819. \definedummyletter{_}%
  2820. \definedummyletter{,}%
  2821. \definedummyletter{"}%
  2822. \definedummyletter{`}%
  2823. \definedummyletter{'}%
  2824. \definedummyletter{^}%
  2825. \definedummyletter{~}%
  2826. \definedummyletter{=}%
  2827. \definedummyword{u}%
  2828. \definedummyword{v}%
  2829. \definedummyword{H}%
  2830. \definedummyword{dotaccent}%
  2831. \definedummyword{ringaccent}%
  2832. \definedummyword{tieaccent}%
  2833. \definedummyword{ubaraccent}%
  2834. \definedummyword{udotaccent}%
  2835. \definedummyword{dotless}%
  2836. %
  2837. % Other non-English letters.
  2838. \definedummyword{AA}%
  2839. \definedummyword{AE}%
  2840. \definedummyword{L}%
  2841. \definedummyword{OE}%
  2842. \definedummyword{O}%
  2843. \definedummyword{aa}%
  2844. \definedummyword{ae}%
  2845. \definedummyword{l}%
  2846. \definedummyword{oe}%
  2847. \definedummyword{o}%
  2848. \definedummyword{ss}%
  2849. %
  2850. % Although these internal commands shouldn't show up, sometimes they do.
  2851. \definedummyword{bf}%
  2852. \definedummyword{gtr}%
  2853. \definedummyword{hat}%
  2854. \definedummyword{less}%
  2855. \definedummyword{sf}%
  2856. \definedummyword{sl}%
  2857. \definedummyword{tclose}%
  2858. \definedummyword{tt}%
  2859. %
  2860. % Texinfo font commands.
  2861. \definedummyword{b}%
  2862. \definedummyword{i}%
  2863. \definedummyword{r}%
  2864. \definedummyword{sc}%
  2865. \definedummyword{t}%
  2866. %
  2867. \definedummyword{TeX}%
  2868. \definedummyword{acronym}%
  2869. \definedummyword{cite}%
  2870. \definedummyword{code}%
  2871. \definedummyword{command}%
  2872. \definedummyword{dfn}%
  2873. \definedummyword{dots}%
  2874. \definedummyword{emph}%
  2875. \definedummyword{env}%
  2876. \definedummyword{file}%
  2877. \definedummyword{kbd}%
  2878. \definedummyword{key}%
  2879. \definedummyword{math}%
  2880. \definedummyword{option}%
  2881. \definedummyword{samp}%
  2882. \definedummyword{strong}%
  2883. \definedummyword{uref}%
  2884. \definedummyword{url}%
  2885. \definedummyword{var}%
  2886. \definedummyword{w}%
  2887. %
  2888. % Assorted special characters.
  2889. \definedummyword{bullet}%
  2890. \definedummyword{copyright}%
  2891. \definedummyword{dots}%
  2892. \definedummyword{enddots}%
  2893. \definedummyword{equiv}%
  2894. \definedummyword{error}%
  2895. \definedummyword{expansion}%
  2896. \definedummyword{minus}%
  2897. \definedummyword{pounds}%
  2898. \definedummyword{point}%
  2899. \definedummyword{print}%
  2900. \definedummyword{result}%
  2901. %
  2902. % Handle some cases of @value -- where the variable name does not
  2903. % contain - or _, and the value does not contain any
  2904. % (non-fully-expandable) commands.
  2905. \let\value = \expandablevalue
  2906. %
  2907. % Normal spaces, not active ones.
  2908. \unsepspaces
  2909. %
  2910. % No macro expansion.
  2911. \turnoffmacros
  2912. }
  2913. % If an index command is used in an @example environment, any spaces
  2914. % therein should become regular spaces in the raw index file, not the
  2915. % expansion of \tie (\leavevmode \penalty \@M \ ).
  2916. {\obeyspaces
  2917. \gdef\unsepspaces{\obeyspaces\let =\space}}
  2918. % \indexnofonts is used when outputting the strings to sort the index
  2919. % by, and when constructing control sequence names. It eliminates all
  2920. % control sequences and just writes whatever the best ASCII sort string
  2921. % would be for a given command (usually its argument).
  2922. %
  2923. \def\indexdummytex{TeX}
  2924. \def\indexdummydots{...}
  2925. %
  2926. \def\indexnofonts{%
  2927. \def\ { }%
  2928. \def\@{@}%
  2929. % how to handle braces?
  2930. \def\_{\normalunderscore}%
  2931. %
  2932. \let\,=\asis
  2933. \let\"=\asis
  2934. \let\`=\asis
  2935. \let\'=\asis
  2936. \let\^=\asis
  2937. \let\~=\asis
  2938. \let\==\asis
  2939. \let\u=\asis
  2940. \let\v=\asis
  2941. \let\H=\asis
  2942. \let\dotaccent=\asis
  2943. \let\ringaccent=\asis
  2944. \let\tieaccent=\asis
  2945. \let\ubaraccent=\asis
  2946. \let\udotaccent=\asis
  2947. \let\dotless=\asis
  2948. %
  2949. % Other non-English letters.
  2950. \def\AA{AA}%
  2951. \def\AE{AE}%
  2952. \def\L{L}%
  2953. \def\OE{OE}%
  2954. \def\O{O}%
  2955. \def\aa{aa}%
  2956. \def\ae{ae}%
  2957. \def\l{l}%
  2958. \def\oe{oe}%
  2959. \def\o{o}%
  2960. \def\ss{ss}%
  2961. \def\exclamdown{!}%
  2962. \def\questiondown{?}%
  2963. %
  2964. % Don't no-op \tt, since it isn't a user-level command
  2965. % and is used in the definitions of the active chars like <, >, |, etc.
  2966. % Likewise with the other plain tex font commands.
  2967. %\let\tt=\asis
  2968. %
  2969. % Texinfo font commands.
  2970. \let\b=\asis
  2971. \let\i=\asis
  2972. \let\r=\asis
  2973. \let\sc=\asis
  2974. \let\t=\asis
  2975. %
  2976. \let\TeX=\indexdummytex
  2977. \let\acronym=\asis
  2978. \let\cite=\asis
  2979. \let\code=\asis
  2980. \let\command=\asis
  2981. \let\dfn=\asis
  2982. \let\dots=\indexdummydots
  2983. \let\emph=\asis
  2984. \let\env=\asis
  2985. \let\file=\asis
  2986. \let\kbd=\asis
  2987. \let\key=\asis
  2988. \let\math=\asis
  2989. \let\option=\asis
  2990. \let\samp=\asis
  2991. \let\strong=\asis
  2992. \let\uref=\asis
  2993. \let\url=\asis
  2994. \let\var=\asis
  2995. \let\w=\asis
  2996. }
  2997. \let\indexbackslash=0 %overridden during \printindex.
  2998. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  2999. % For \ifx comparisons.
  3000. \def\emptymacro{\empty}
  3001. % Most index entries go through here, but \dosubind is the general case.
  3002. %
  3003. \def\doind#1#2{\dosubind{#1}{#2}\empty}
  3004. % Workhorse for all \fooindexes.
  3005. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  3006. % \empty if called from \doind, as we usually are. The main exception
  3007. % is with defuns, which call us directly.
  3008. %
  3009. \def\dosubind#1#2#3{%
  3010. % Put the index entry in the margin if desired.
  3011. \ifx\SETmarginindex\relax\else
  3012. \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}%
  3013. \fi
  3014. {%
  3015. \count255=\lastpenalty
  3016. {%
  3017. \indexdummies % Must do this here, since \bf, etc expand at this stage
  3018. \escapechar=`\\
  3019. {%
  3020. \let\folio = 0% We will expand all macros now EXCEPT \folio.
  3021. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  3022. % so it will be output as is; and it will print as backslash.
  3023. %
  3024. % The main index entry text.
  3025. \toks0 = {#2}%
  3026. %
  3027. % If third arg is present, precede it with space in sort key.
  3028. \def\thirdarg{#3}%
  3029. \ifx\thirdarg\emptymacro \else
  3030. % If the third (subentry) arg is present, add it to the index
  3031. % line to write.
  3032. \toks0 = \expandafter{\the\toks0 \space #3}%
  3033. \fi
  3034. %
  3035. % Process the index entry with all font commands turned off, to
  3036. % get the string to sort by.
  3037. {\indexnofonts
  3038. \edef\temp{\the\toks0}% need full expansion
  3039. \xdef\indexsorttmp{\temp}%
  3040. }%
  3041. %
  3042. % Set up the complete index entry, with both the sort key and
  3043. % the original text, including any font commands. We write
  3044. % three arguments to \entry to the .?? file (four in the
  3045. % subentry case), texindex reduces to two when writing the .??s
  3046. % sorted result.
  3047. \edef\temp{%
  3048. \write\csname#1indfile\endcsname{%
  3049. \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}%
  3050. }%
  3051. %
  3052. % If a skip is the last thing on the list now, preserve it
  3053. % by backing up by \lastskip, doing the \write, then inserting
  3054. % the skip again. Otherwise, the whatsit generated by the
  3055. % \write will make \lastskip zero. The result is that sequences
  3056. % like this:
  3057. % @end defun
  3058. % @tindex whatever
  3059. % @defun ...
  3060. % will have extra space inserted, because the \medbreak in the
  3061. % start of the @defun won't see the skip inserted by the @end of
  3062. % the previous defun.
  3063. %
  3064. % But don't do any of this if we're not in vertical mode. We
  3065. % don't want to do a \vskip and prematurely end a paragraph.
  3066. %
  3067. % Avoid page breaks due to these extra skips, too.
  3068. %
  3069. \iflinks
  3070. \ifvmode
  3071. \skip0 = \lastskip
  3072. \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi
  3073. \fi
  3074. %
  3075. \temp % do the write
  3076. %
  3077. \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi
  3078. \fi
  3079. }%
  3080. }%
  3081. \penalty\count255
  3082. }%
  3083. }
  3084. % The index entry written in the file actually looks like
  3085. % \entry {sortstring}{page}{topic}
  3086. % or
  3087. % \entry {sortstring}{page}{topic}{subtopic}
  3088. % The texindex program reads in these files and writes files
  3089. % containing these kinds of lines:
  3090. % \initial {c}
  3091. % before the first topic whose initial is c
  3092. % \entry {topic}{pagelist}
  3093. % for a topic that is used without subtopics
  3094. % \primary {topic}
  3095. % for the beginning of a topic that is used with subtopics
  3096. % \secondary {subtopic}{pagelist}
  3097. % for each subtopic.
  3098. % Define the user-accessible indexing commands
  3099. % @findex, @vindex, @kindex, @cindex.
  3100. \def\findex {\fnindex}
  3101. \def\kindex {\kyindex}
  3102. \def\cindex {\cpindex}
  3103. \def\vindex {\vrindex}
  3104. \def\tindex {\tpindex}
  3105. \def\pindex {\pgindex}
  3106. \def\cindexsub {\begingroup\obeylines\cindexsub}
  3107. {\obeylines %
  3108. \gdef\cindexsub "#1" #2^^M{\endgroup %
  3109. \dosubind{cp}{#2}{#1}}}
  3110. % Define the macros used in formatting output of the sorted index material.
  3111. % @printindex causes a particular index (the ??s file) to get printed.
  3112. % It does not print any chapter heading (usually an @unnumbered).
  3113. %
  3114. \def\printindex{\parsearg\doprintindex}
  3115. \def\doprintindex#1{\begingroup
  3116. \dobreak \chapheadingskip{10000}%
  3117. %
  3118. \smallfonts \rm
  3119. \tolerance = 9500
  3120. \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  3121. \indexbreaks
  3122. %
  3123. % See if the index file exists and is nonempty.
  3124. % Change catcode of @ here so that if the index file contains
  3125. % \initial {@}
  3126. % as its first line, TeX doesn't complain about mismatched braces
  3127. % (because it thinks @} is a control sequence).
  3128. \catcode`\@ = 11
  3129. \openin 1 \jobname.#1s
  3130. \ifeof 1
  3131. % \enddoublecolumns gets confused if there is no text in the index,
  3132. % and it loses the chapter title and the aux file entries for the
  3133. % index. The easiest way to prevent this problem is to make sure
  3134. % there is some text.
  3135. \putwordIndexNonexistent
  3136. \else
  3137. %
  3138. % If the index file exists but is empty, then \openin leaves \ifeof
  3139. % false. We have to make TeX try to read something from the file, so
  3140. % it can discover if there is anything in it.
  3141. \read 1 to \temp
  3142. \ifeof 1
  3143. \putwordIndexIsEmpty
  3144. \else
  3145. % Index files are almost Texinfo source, but we use \ as the escape
  3146. % character. It would be better to use @, but that's too big a change
  3147. % to make right now.
  3148. \def\indexbackslash{\rawbackslashxx}%
  3149. \catcode`\\ = 0
  3150. \escapechar = `\\
  3151. \begindoublecolumns
  3152. \input \jobname.#1s
  3153. \enddoublecolumns
  3154. \fi
  3155. \fi
  3156. \closein 1
  3157. \endgroup}
  3158. % These macros are used by the sorted index file itself.
  3159. % Change them to control the appearance of the index.
  3160. \def\initial#1{{%
  3161. % Some minor font changes for the special characters.
  3162. \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  3163. %
  3164. % Remove any glue we may have, we'll be inserting our own.
  3165. \removelastskip
  3166. %
  3167. % We like breaks before the index initials, so insert a bonus.
  3168. \penalty -300
  3169. %
  3170. % Typeset the initial. Making this add up to a whole number of
  3171. % baselineskips increases the chance of the dots lining up from column
  3172. % to column. It still won't often be perfect, because of the stretch
  3173. % we need before each entry, but it's better.
  3174. %
  3175. % No shrink because it confuses \balancecolumns.
  3176. \vskip 1.67\baselineskip plus .5\baselineskip
  3177. \leftline{\secbf #1}%
  3178. \vskip .33\baselineskip plus .1\baselineskip
  3179. %
  3180. % Do our best not to break after the initial.
  3181. \nobreak
  3182. }}
  3183. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  3184. % flush to the right margin. It is used for index and table of contents
  3185. % entries. The paragraph is indented by \leftskip.
  3186. %
  3187. \def\entry#1#2{\begingroup
  3188. %
  3189. % Start a new paragraph if necessary, so our assignments below can't
  3190. % affect previous text.
  3191. \par
  3192. %
  3193. % Do not fill out the last line with white space.
  3194. \parfillskip = 0in
  3195. %
  3196. % No extra space above this paragraph.
  3197. \parskip = 0in
  3198. %
  3199. % Do not prefer a separate line ending with a hyphen to fewer lines.
  3200. \finalhyphendemerits = 0
  3201. %
  3202. % \hangindent is only relevant when the entry text and page number
  3203. % don't both fit on one line. In that case, bob suggests starting the
  3204. % dots pretty far over on the line. Unfortunately, a large
  3205. % indentation looks wrong when the entry text itself is broken across
  3206. % lines. So we use a small indentation and put up with long leaders.
  3207. %
  3208. % \hangafter is reset to 1 (which is the value we want) at the start
  3209. % of each paragraph, so we need not do anything with that.
  3210. \hangindent = 2em
  3211. %
  3212. % When the entry text needs to be broken, just fill out the first line
  3213. % with blank space.
  3214. \rightskip = 0pt plus1fil
  3215. %
  3216. % A bit of stretch before each entry for the benefit of balancing columns.
  3217. \vskip 0pt plus1pt
  3218. %
  3219. % Start a ``paragraph'' for the index entry so the line breaking
  3220. % parameters we've set above will have an effect.
  3221. \noindent
  3222. %
  3223. % Insert the text of the index entry. TeX will do line-breaking on it.
  3224. #1%
  3225. % The following is kludged to not output a line of dots in the index if
  3226. % there are no page numbers. The next person who breaks this will be
  3227. % cursed by a Unix daemon.
  3228. \def\tempa{{\rm }}%
  3229. \def\tempb{#2}%
  3230. \edef\tempc{\tempa}%
  3231. \edef\tempd{\tempb}%
  3232. \ifx\tempc\tempd\ \else%
  3233. %
  3234. % If we must, put the page number on a line of its own, and fill out
  3235. % this line with blank space. (The \hfil is overwhelmed with the
  3236. % fill leaders glue in \indexdotfill if the page number does fit.)
  3237. \hfil\penalty50
  3238. \null\nobreak\indexdotfill % Have leaders before the page number.
  3239. %
  3240. % The `\ ' here is removed by the implicit \unskip that TeX does as
  3241. % part of (the primitive) \par. Without it, a spurious underfull
  3242. % \hbox ensues.
  3243. \ifpdf
  3244. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  3245. \else
  3246. \ #2% The page number ends the paragraph.
  3247. \fi
  3248. \fi%
  3249. \par
  3250. \endgroup}
  3251. % Like \dotfill except takes at least 1 em.
  3252. \def\indexdotfill{\cleaders
  3253. \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  3254. \def\primary #1{\line{#1\hfil}}
  3255. \newskip\secondaryindent \secondaryindent=0.5cm
  3256. \def\secondary#1#2{{%
  3257. \parfillskip=0in
  3258. \parskip=0in
  3259. \hangindent=1in
  3260. \hangafter=1
  3261. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  3262. \ifpdf
  3263. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  3264. \else
  3265. #2
  3266. \fi
  3267. \par
  3268. }}
  3269. % Define two-column mode, which we use to typeset indexes.
  3270. % Adapted from the TeXbook, page 416, which is to say,
  3271. % the manmac.tex format used to print the TeXbook itself.
  3272. \catcode`\@=11
  3273. \newbox\partialpage
  3274. \newdimen\doublecolumnhsize
  3275. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  3276. % Grab any single-column material above us.
  3277. \output = {%
  3278. %
  3279. % Here is a possibility not foreseen in manmac: if we accumulate a
  3280. % whole lot of material, we might end up calling this \output
  3281. % routine twice in a row (see the doublecol-lose test, which is
  3282. % essentially a couple of indexes with @setchapternewpage off). In
  3283. % that case we just ship out what is in \partialpage with the normal
  3284. % output routine. Generally, \partialpage will be empty when this
  3285. % runs and this will be a no-op. See the indexspread.tex test case.
  3286. \ifvoid\partialpage \else
  3287. \onepageout{\pagecontents\partialpage}%
  3288. \fi
  3289. %
  3290. \global\setbox\partialpage = \vbox{%
  3291. % Unvbox the main output page.
  3292. \unvbox\PAGE
  3293. \kern-\topskip \kern\baselineskip
  3294. }%
  3295. }%
  3296. \eject % run that output routine to set \partialpage
  3297. %
  3298. % Use the double-column output routine for subsequent pages.
  3299. \output = {\doublecolumnout}%
  3300. %
  3301. % Change the page size parameters. We could do this once outside this
  3302. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  3303. % format, but then we repeat the same computation. Repeating a couple
  3304. % of assignments once per index is clearly meaningless for the
  3305. % execution time, so we may as well do it in one place.
  3306. %
  3307. % First we halve the line length, less a little for the gutter between
  3308. % the columns. We compute the gutter based on the line length, so it
  3309. % changes automatically with the paper format. The magic constant
  3310. % below is chosen so that the gutter has the same value (well, +-<1pt)
  3311. % as it did when we hard-coded it.
  3312. %
  3313. % We put the result in a separate register, \doublecolumhsize, so we
  3314. % can restore it in \pagesofar, after \hsize itself has (potentially)
  3315. % been clobbered.
  3316. %
  3317. \doublecolumnhsize = \hsize
  3318. \advance\doublecolumnhsize by -.04154\hsize
  3319. \divide\doublecolumnhsize by 2
  3320. \hsize = \doublecolumnhsize
  3321. %
  3322. % Double the \vsize as well. (We don't need a separate register here,
  3323. % since nobody clobbers \vsize.)
  3324. \vsize = 2\vsize
  3325. }
  3326. % The double-column output routine for all double-column pages except
  3327. % the last.
  3328. %
  3329. \def\doublecolumnout{%
  3330. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  3331. % Get the available space for the double columns -- the normal
  3332. % (undoubled) page height minus any material left over from the
  3333. % previous page.
  3334. \dimen@ = \vsize
  3335. \divide\dimen@ by 2
  3336. \advance\dimen@ by -\ht\partialpage
  3337. %
  3338. % box0 will be the left-hand column, box2 the right.
  3339. \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  3340. \onepageout\pagesofar
  3341. \unvbox255
  3342. \penalty\outputpenalty
  3343. }
  3344. %
  3345. % Re-output the contents of the output page -- any previous material,
  3346. % followed by the two boxes we just split, in box0 and box2.
  3347. \def\pagesofar{%
  3348. \unvbox\partialpage
  3349. %
  3350. \hsize = \doublecolumnhsize
  3351. \wd0=\hsize \wd2=\hsize
  3352. \hbox to\pagewidth{\box0\hfil\box2}%
  3353. }
  3354. %
  3355. % All done with double columns.
  3356. \def\enddoublecolumns{%
  3357. \output = {%
  3358. % Split the last of the double-column material. Leave it on the
  3359. % current page, no automatic page break.
  3360. \balancecolumns
  3361. %
  3362. % If we end up splitting too much material for the current page,
  3363. % though, there will be another page break right after this \output
  3364. % invocation ends. Having called \balancecolumns once, we do not
  3365. % want to call it again. Therefore, reset \output to its normal
  3366. % definition right away. (We hope \balancecolumns will never be
  3367. % called on to balance too much material, but if it is, this makes
  3368. % the output somewhat more palatable.)
  3369. \global\output = {\onepageout{\pagecontents\PAGE}}%
  3370. }%
  3371. \eject
  3372. \endgroup % started in \begindoublecolumns
  3373. %
  3374. % \pagegoal was set to the doubled \vsize above, since we restarted
  3375. % the current page. We're now back to normal single-column
  3376. % typesetting, so reset \pagegoal to the normal \vsize (after the
  3377. % \endgroup where \vsize got restored).
  3378. \pagegoal = \vsize
  3379. }
  3380. %
  3381. % Called at the end of the double column material.
  3382. \def\balancecolumns{%
  3383. \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120.
  3384. \dimen@ = \ht0
  3385. \advance\dimen@ by \topskip
  3386. \advance\dimen@ by-\baselineskip
  3387. \divide\dimen@ by 2 % target to split to
  3388. %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}%
  3389. \splittopskip = \topskip
  3390. % Loop until we get a decent breakpoint.
  3391. {%
  3392. \vbadness = 10000
  3393. \loop
  3394. \global\setbox3 = \copy0
  3395. \global\setbox1 = \vsplit3 to \dimen@
  3396. \ifdim\ht3>\dimen@
  3397. \global\advance\dimen@ by 1pt
  3398. \repeat
  3399. }%
  3400. %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}%
  3401. \setbox0=\vbox to\dimen@{\unvbox1}%
  3402. \setbox2=\vbox to\dimen@{\unvbox3}%
  3403. %
  3404. \pagesofar
  3405. }
  3406. \catcode`\@ = \other
  3407. \message{sectioning,}
  3408. % Chapters, sections, etc.
  3409. \newcount\chapno
  3410. \newcount\secno \secno=0
  3411. \newcount\subsecno \subsecno=0
  3412. \newcount\subsubsecno \subsubsecno=0
  3413. % This counter is funny since it counts through charcodes of letters A, B, ...
  3414. \newcount\appendixno \appendixno = `\@
  3415. % \def\appendixletter{\char\the\appendixno}
  3416. % We do the following for the sake of pdftex, which needs the actual
  3417. % letter in the expansion, not just typeset.
  3418. \def\appendixletter{%
  3419. \ifnum\appendixno=`A A%
  3420. \else\ifnum\appendixno=`B B%
  3421. \else\ifnum\appendixno=`C C%
  3422. \else\ifnum\appendixno=`D D%
  3423. \else\ifnum\appendixno=`E E%
  3424. \else\ifnum\appendixno=`F F%
  3425. \else\ifnum\appendixno=`G G%
  3426. \else\ifnum\appendixno=`H H%
  3427. \else\ifnum\appendixno=`I I%
  3428. \else\ifnum\appendixno=`J J%
  3429. \else\ifnum\appendixno=`K K%
  3430. \else\ifnum\appendixno=`L L%
  3431. \else\ifnum\appendixno=`M M%
  3432. \else\ifnum\appendixno=`N N%
  3433. \else\ifnum\appendixno=`O O%
  3434. \else\ifnum\appendixno=`P P%
  3435. \else\ifnum\appendixno=`Q Q%
  3436. \else\ifnum\appendixno=`R R%
  3437. \else\ifnum\appendixno=`S S%
  3438. \else\ifnum\appendixno=`T T%
  3439. \else\ifnum\appendixno=`U U%
  3440. \else\ifnum\appendixno=`V V%
  3441. \else\ifnum\appendixno=`W W%
  3442. \else\ifnum\appendixno=`X X%
  3443. \else\ifnum\appendixno=`Y Y%
  3444. \else\ifnum\appendixno=`Z Z%
  3445. % The \the is necessary, despite appearances, because \appendixletter is
  3446. % expanded while writing the .toc file. \char\appendixno is not
  3447. % expandable, thus it is written literally, thus all appendixes come out
  3448. % with the same letter (or @) in the toc without it.
  3449. \else\char\the\appendixno
  3450. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  3451. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  3452. % Each @chapter defines this as the name of the chapter.
  3453. % page headings and footings can use it. @section does likewise.
  3454. \def\thischapter{}
  3455. \def\thissection{}
  3456. \newcount\absseclevel % used to calculate proper heading level
  3457. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  3458. % @raisesections: treat @section as chapter, @subsection as section, etc.
  3459. \def\raisesections{\global\advance\secbase by -1}
  3460. \let\up=\raisesections % original BFox name
  3461. % @lowersections: treat @chapter as section, @section as subsection, etc.
  3462. \def\lowersections{\global\advance\secbase by 1}
  3463. \let\down=\lowersections % original BFox name
  3464. % Choose a numbered-heading macro
  3465. % #1 is heading level if unmodified by @raisesections or @lowersections
  3466. % #2 is text for heading
  3467. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  3468. \ifcase\absseclevel
  3469. \chapterzzz{#2}
  3470. \or
  3471. \seczzz{#2}
  3472. \or
  3473. \numberedsubseczzz{#2}
  3474. \or
  3475. \numberedsubsubseczzz{#2}
  3476. \else
  3477. \ifnum \absseclevel<0
  3478. \chapterzzz{#2}
  3479. \else
  3480. \numberedsubsubseczzz{#2}
  3481. \fi
  3482. \fi
  3483. \suppressfirstparagraphindent
  3484. }
  3485. % like \numhead, but chooses appendix heading levels
  3486. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  3487. \ifcase\absseclevel
  3488. \appendixzzz{#2}
  3489. \or
  3490. \appendixsectionzzz{#2}
  3491. \or
  3492. \appendixsubseczzz{#2}
  3493. \or
  3494. \appendixsubsubseczzz{#2}
  3495. \else
  3496. \ifnum \absseclevel<0
  3497. \appendixzzz{#2}
  3498. \else
  3499. \appendixsubsubseczzz{#2}
  3500. \fi
  3501. \fi
  3502. \suppressfirstparagraphindent
  3503. }
  3504. % like \numhead, but chooses numberless heading levels
  3505. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  3506. \ifcase\absseclevel
  3507. \unnumberedzzz{#2}
  3508. \or
  3509. \unnumberedseczzz{#2}
  3510. \or
  3511. \unnumberedsubseczzz{#2}
  3512. \or
  3513. \unnumberedsubsubseczzz{#2}
  3514. \else
  3515. \ifnum \absseclevel<0
  3516. \unnumberedzzz{#2}
  3517. \else
  3518. \unnumberedsubsubseczzz{#2}
  3519. \fi
  3520. \fi
  3521. \suppressfirstparagraphindent
  3522. }
  3523. % @chapter, @appendix, @unnumbered.
  3524. \def\thischaptername{No Chapter Title}
  3525. \outer\def\chapter{\parsearg\chapteryyy}
  3526. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  3527. \def\chapterzzz #1{%
  3528. \secno=0 \subsecno=0 \subsubsecno=0
  3529. \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}%
  3530. \chapmacro {#1}{\the\chapno}%
  3531. \gdef\thissection{#1}%
  3532. \gdef\thischaptername{#1}%
  3533. % We don't substitute the actual chapter name into \thischapter
  3534. % because we don't want its macros evaluated now.
  3535. \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  3536. \writetocentry{chap}{#1}{{\the\chapno}}
  3537. \donoderef
  3538. \global\let\section = \numberedsec
  3539. \global\let\subsection = \numberedsubsec
  3540. \global\let\subsubsection = \numberedsubsubsec
  3541. }
  3542. % we use \chapno to avoid indenting back
  3543. \def\appendixbox#1{%
  3544. \setbox0 = \hbox{\putwordAppendix{} \the\chapno}%
  3545. \hbox to \wd0{#1\hss}}
  3546. \outer\def\appendix{\parsearg\appendixyyy}
  3547. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  3548. \def\appendixzzz #1{%
  3549. \secno=0 \subsecno=0 \subsubsecno=0
  3550. \global\advance \appendixno by 1
  3551. \message{\putwordAppendix\space \appendixletter}%
  3552. \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}%
  3553. \gdef\thissection{#1}%
  3554. \gdef\thischaptername{#1}%
  3555. \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  3556. \writetocentry{appendix}{#1}{{\appendixletter}}
  3557. \appendixnoderef
  3558. \global\let\section = \appendixsec
  3559. \global\let\subsection = \appendixsubsec
  3560. \global\let\subsubsection = \appendixsubsubsec
  3561. }
  3562. % @centerchap is like @unnumbered, but the heading is centered.
  3563. \outer\def\centerchap{\parsearg\centerchapyyy}
  3564. \def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}}
  3565. % @top is like @unnumbered.
  3566. \outer\def\top{\parsearg\unnumberedyyy}
  3567. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  3568. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  3569. \def\unnumberedzzz #1{%
  3570. \secno=0 \subsecno=0 \subsubsecno=0
  3571. %
  3572. % This used to be simply \message{#1}, but TeX fully expands the
  3573. % argument to \message. Therefore, if #1 contained @-commands, TeX
  3574. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  3575. % expanded @cite (which turns out to cause errors because \cite is meant
  3576. % to be executed, not expanded).
  3577. %
  3578. % Anyway, we don't want the fully-expanded definition of @cite to appear
  3579. % as a result of the \message, we just want `@cite' itself. We use
  3580. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  3581. % simply yielding the contents of <toks register>. (We also do this for
  3582. % the toc entries.)
  3583. \toks0 = {#1}\message{(\the\toks0)}%
  3584. %
  3585. \unnumbchapmacro {#1}%
  3586. \gdef\thischapter{#1}\gdef\thissection{#1}%
  3587. \writetocentry{unnumbchap}{#1}{{\the\chapno}}
  3588. \unnumbnoderef
  3589. \global\let\section = \unnumberedsec
  3590. \global\let\subsection = \unnumberedsubsec
  3591. \global\let\subsubsection = \unnumberedsubsubsec
  3592. }
  3593. % Sections.
  3594. \outer\def\numberedsec{\parsearg\secyyy}
  3595. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  3596. \def\seczzz #1{%
  3597. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  3598. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  3599. \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}}
  3600. \donoderef
  3601. \nobreak
  3602. }
  3603. \outer\def\appendixsection{\parsearg\appendixsecyyy}
  3604. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  3605. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  3606. \def\appendixsectionzzz #1{%
  3607. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  3608. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  3609. \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}}
  3610. \appendixnoderef
  3611. \nobreak
  3612. }
  3613. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  3614. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  3615. \def\unnumberedseczzz #1{%
  3616. \plainsecheading {#1}\gdef\thissection{#1}%
  3617. \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}}
  3618. \unnumbnoderef
  3619. \nobreak
  3620. }
  3621. % Subsections.
  3622. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  3623. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  3624. \def\numberedsubseczzz #1{%
  3625. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  3626. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  3627. \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
  3628. \donoderef
  3629. \nobreak
  3630. }
  3631. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  3632. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  3633. \def\appendixsubseczzz #1{%
  3634. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  3635. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  3636. \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}}
  3637. \appendixnoderef
  3638. \nobreak
  3639. }
  3640. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  3641. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  3642. \def\unnumberedsubseczzz #1{%
  3643. \plainsubsecheading {#1}\gdef\thissection{#1}%
  3644. \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}}
  3645. \unnumbnoderef
  3646. \nobreak
  3647. }
  3648. % Subsubsections.
  3649. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  3650. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  3651. \def\numberedsubsubseczzz #1{%
  3652. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  3653. \subsubsecheading {#1}
  3654. {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  3655. \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  3656. \donoderef
  3657. \nobreak
  3658. }
  3659. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  3660. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  3661. \def\appendixsubsubseczzz #1{%
  3662. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  3663. \subsubsecheading {#1}
  3664. {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  3665. \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  3666. \appendixnoderef
  3667. \nobreak
  3668. }
  3669. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  3670. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  3671. \def\unnumberedsubsubseczzz #1{%
  3672. \plainsubsubsecheading {#1}\gdef\thissection{#1}%
  3673. \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}
  3674. \unnumbnoderef
  3675. \nobreak
  3676. }
  3677. % These are variants which are not "outer", so they can appear in @ifinfo.
  3678. % Actually, they should now be obsolete; ordinary section commands should work.
  3679. \def\infotop{\parsearg\unnumberedzzz}
  3680. \def\infounnumbered{\parsearg\unnumberedzzz}
  3681. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  3682. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  3683. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  3684. \def\infoappendix{\parsearg\appendixzzz}
  3685. \def\infoappendixsec{\parsearg\appendixseczzz}
  3686. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  3687. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  3688. \def\infochapter{\parsearg\chapterzzz}
  3689. \def\infosection{\parsearg\sectionzzz}
  3690. \def\infosubsection{\parsearg\subsectionzzz}
  3691. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  3692. % These macros control what the section commands do, according
  3693. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  3694. % Define them by default for a numbered chapter.
  3695. \global\let\section = \numberedsec
  3696. \global\let\subsection = \numberedsubsec
  3697. \global\let\subsubsection = \numberedsubsubsec
  3698. % Define @majorheading, @heading and @subheading
  3699. % NOTE on use of \vbox for chapter headings, section headings, and such:
  3700. % 1) We use \vbox rather than the earlier \line to permit
  3701. % overlong headings to fold.
  3702. % 2) \hyphenpenalty is set to 10000 because hyphenation in a
  3703. % heading is obnoxious; this forbids it.
  3704. % 3) Likewise, headings look best if no \parindent is used, and
  3705. % if justification is not attempted. Hence \raggedright.
  3706. \def\majorheading{\parsearg\majorheadingzzz}
  3707. \def\majorheadingzzz #1{%
  3708. {\advance\chapheadingskip by 10pt \chapbreak }%
  3709. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3710. \parindent=0pt\raggedright
  3711. \rm #1\hfill}}\bigskip \par\penalty 200}
  3712. \def\chapheading{\parsearg\chapheadingzzz}
  3713. \def\chapheadingzzz #1{\chapbreak %
  3714. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3715. \parindent=0pt\raggedright
  3716. \rm #1\hfill}}\bigskip \par\penalty 200}
  3717. % @heading, @subheading, @subsubheading.
  3718. \def\heading{\parsearg\plainsecheading}
  3719. \def\subheading{\parsearg\plainsubsecheading}
  3720. \def\subsubheading{\parsearg\plainsubsubsecheading}
  3721. % These macros generate a chapter, section, etc. heading only
  3722. % (including whitespace, linebreaking, etc. around it),
  3723. % given all the information in convenient, parsed form.
  3724. %%% Args are the skip and penalty (usually negative)
  3725. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  3726. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  3727. %%% Define plain chapter starts, and page on/off switching for it
  3728. % Parameter controlling skip before chapter headings (if needed)
  3729. \newskip\chapheadingskip
  3730. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  3731. \def\chappager{\par\vfill\supereject}
  3732. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  3733. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  3734. \def\CHAPPAGoff{%
  3735. \global\let\contentsalignmacro = \chappager
  3736. \global\let\pchapsepmacro=\chapbreak
  3737. \global\let\pagealignmacro=\chappager}
  3738. \def\CHAPPAGon{%
  3739. \global\let\contentsalignmacro = \chappager
  3740. \global\let\pchapsepmacro=\chappager
  3741. \global\let\pagealignmacro=\chappager
  3742. \global\def\HEADINGSon{\HEADINGSsingle}}
  3743. \def\CHAPPAGodd{
  3744. \global\let\contentsalignmacro = \chapoddpage
  3745. \global\let\pchapsepmacro=\chapoddpage
  3746. \global\let\pagealignmacro=\chapoddpage
  3747. \global\def\HEADINGSon{\HEADINGSdouble}}
  3748. \CHAPPAGon
  3749. \def\CHAPFplain{
  3750. \global\let\chapmacro=\chfplain
  3751. \global\let\unnumbchapmacro=\unnchfplain
  3752. \global\let\centerchapmacro=\centerchfplain}
  3753. % Plain chapter opening.
  3754. % #1 is the text, #2 the chapter number or empty if unnumbered.
  3755. \def\chfplain#1#2{%
  3756. \pchapsepmacro
  3757. {%
  3758. \chapfonts \rm
  3759. \def\chapnum{#2}%
  3760. \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}%
  3761. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  3762. \hangindent = \wd0 \centerparametersmaybe
  3763. \unhbox0 #1\par}%
  3764. }%
  3765. \nobreak\bigskip % no page break after a chapter title
  3766. \nobreak
  3767. }
  3768. % Plain opening for unnumbered.
  3769. \def\unnchfplain#1{\chfplain{#1}{}}
  3770. % @centerchap -- centered and unnumbered.
  3771. \let\centerparametersmaybe = \relax
  3772. \def\centerchfplain#1{{%
  3773. \def\centerparametersmaybe{%
  3774. \advance\rightskip by 3\rightskip
  3775. \leftskip = \rightskip
  3776. \parfillskip = 0pt
  3777. }%
  3778. \chfplain{#1}{}%
  3779. }}
  3780. \CHAPFplain % The default
  3781. \def\unnchfopen #1{%
  3782. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3783. \parindent=0pt\raggedright
  3784. \rm #1\hfill}}\bigskip \par\nobreak
  3785. }
  3786. \def\chfopen #1#2{\chapoddpage {\chapfonts
  3787. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  3788. \par\penalty 5000 %
  3789. }
  3790. \def\centerchfopen #1{%
  3791. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  3792. \parindent=0pt
  3793. \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
  3794. }
  3795. \def\CHAPFopen{
  3796. \global\let\chapmacro=\chfopen
  3797. \global\let\unnumbchapmacro=\unnchfopen
  3798. \global\let\centerchapmacro=\centerchfopen}
  3799. % Section titles.
  3800. \newskip\secheadingskip
  3801. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  3802. \def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}}
  3803. \def\plainsecheading#1{\sectionheading{sec}{}{#1}}
  3804. % Subsection titles.
  3805. \newskip \subsecheadingskip
  3806. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  3807. \def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}}
  3808. \def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}}
  3809. % Subsubsection titles.
  3810. \let\subsubsecheadingskip = \subsecheadingskip
  3811. \let\subsubsecheadingbreak = \subsecheadingbreak
  3812. \def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}}
  3813. \def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}}
  3814. % Print any size section title.
  3815. %
  3816. % #1 is the section type (sec/subsec/subsubsec), #2 is the section
  3817. % number (maybe empty), #3 the text.
  3818. \def\sectionheading#1#2#3{%
  3819. {%
  3820. \expandafter\advance\csname #1headingskip\endcsname by \parskip
  3821. \csname #1headingbreak\endcsname
  3822. }%
  3823. {%
  3824. % Switch to the right set of fonts.
  3825. \csname #1fonts\endcsname \rm
  3826. %
  3827. % Only insert the separating space if we have a section number.
  3828. \def\secnum{#2}%
  3829. \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}%
  3830. %
  3831. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
  3832. \hangindent = \wd0 % zero if no section number
  3833. \unhbox0 #3}%
  3834. }%
  3835. % Add extra space after the heading -- either a line space or a
  3836. % paragraph space, whichever is more. (Some people like to set
  3837. % \parskip to large values for some reason.) Don't allow stretch, though.
  3838. \nobreak
  3839. \ifdim\parskip>\normalbaselineskip
  3840. \kern\parskip
  3841. \else
  3842. \kern\normalbaselineskip
  3843. \fi
  3844. \nobreak
  3845. }
  3846. \message{toc,}
  3847. % Table of contents.
  3848. \newwrite\tocfile
  3849. % Write an entry to the toc file, opening it if necessary.
  3850. % Called from @chapter, etc. We supply {\folio} at the end of the
  3851. % argument, which will end up as the last argument to the \...entry macro.
  3852. %
  3853. % Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}}
  3854. % We open the .toc file for writing here instead of at @setfilename (or
  3855. % any other fixed time) so that @contents can be anywhere in the document.
  3856. %
  3857. \newif\iftocfileopened
  3858. \def\writetocentry#1#2#3{%
  3859. \iftocfileopened\else
  3860. \immediate\openout\tocfile = \jobname.toc
  3861. \global\tocfileopenedtrue
  3862. \fi
  3863. %
  3864. \iflinks
  3865. \toks0 = {#2}%
  3866. \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}%
  3867. \temp
  3868. \fi
  3869. %
  3870. % Tell \shipout to create a page destination if we're doing pdf, which
  3871. % will be the target of the links in the table of contents. We can't
  3872. % just do it on every page because the title pages are numbered 1 and
  3873. % 2 (the page numbers aren't printed), and so are the first two pages
  3874. % of the document. Thus, we'd have two destinations named `1', and
  3875. % two named `2'.
  3876. \ifpdf \pdfmakepagedesttrue \fi
  3877. }
  3878. \newskip\contentsrightmargin \contentsrightmargin=1in
  3879. \newcount\savepageno
  3880. \newcount\lastnegativepageno \lastnegativepageno = -1
  3881. % Finish up the main text and prepare to read what we've written
  3882. % to \tocfile.
  3883. %
  3884. \def\startcontents#1{%
  3885. % If @setchapternewpage on, and @headings double, the contents should
  3886. % start on an odd page, unlike chapters. Thus, we maintain
  3887. % \contentsalignmacro in parallel with \pagealignmacro.
  3888. % From: Torbjorn Granlund <tege@matematik.su.se>
  3889. \contentsalignmacro
  3890. \immediate\closeout\tocfile
  3891. %
  3892. % Don't need to put `Contents' or `Short Contents' in the headline.
  3893. % It is abundantly clear what they are.
  3894. \unnumbchapmacro{#1}\def\thischapter{}%
  3895. \savepageno = \pageno
  3896. \begingroup % Set up to handle contents files properly.
  3897. \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11
  3898. % We can't do this, because then an actual ^ in a section
  3899. % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97.
  3900. %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
  3901. \raggedbottom % Worry more about breakpoints than the bottom.
  3902. \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  3903. %
  3904. % Roman numerals for page numbers.
  3905. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  3906. }
  3907. % Normal (long) toc.
  3908. \def\contents{%
  3909. \startcontents{\putwordTOC}%
  3910. \openin 1 \jobname.toc
  3911. \ifeof 1 \else
  3912. \closein 1
  3913. \input \jobname.toc
  3914. \fi
  3915. \vfill \eject
  3916. \contentsalignmacro % in case @setchapternewpage odd is in effect
  3917. \pdfmakeoutlines
  3918. \endgroup
  3919. \lastnegativepageno = \pageno
  3920. \global\pageno = \savepageno
  3921. }
  3922. % And just the chapters.
  3923. \def\summarycontents{%
  3924. \startcontents{\putwordShortTOC}%
  3925. %
  3926. \let\chapentry = \shortchapentry
  3927. \let\appendixentry = \shortappendixentry
  3928. \let\unnumbchapentry = \shortunnumberedentry
  3929. % We want a true roman here for the page numbers.
  3930. \secfonts
  3931. \let\rm=\shortcontrm \let\bf=\shortcontbf
  3932. \let\sl=\shortcontsl \let\tt=\shortconttt
  3933. \rm
  3934. \hyphenpenalty = 10000
  3935. \advance\baselineskip by 1pt % Open it up a little.
  3936. \def\secentry ##1##2##3##4{}
  3937. \def\subsecentry ##1##2##3##4##5{}
  3938. \def\subsubsecentry ##1##2##3##4##5##6{}
  3939. \let\unnumbsecentry = \secentry
  3940. \let\unnumbsubsecentry = \subsecentry
  3941. \let\unnumbsubsubsecentry = \subsubsecentry
  3942. \openin 1 \jobname.toc
  3943. \ifeof 1 \else
  3944. \closein 1
  3945. \input \jobname.toc
  3946. \fi
  3947. \vfill \eject
  3948. \contentsalignmacro % in case @setchapternewpage odd is in effect
  3949. \endgroup
  3950. \lastnegativepageno = \pageno
  3951. \global\pageno = \savepageno
  3952. }
  3953. \let\shortcontents = \summarycontents
  3954. \ifpdf
  3955. \pdfcatalog{/PageMode /UseOutlines}%
  3956. \fi
  3957. % These macros generate individual entries in the table of contents.
  3958. % The first argument is the chapter or section name.
  3959. % The last argument is the page number.
  3960. % The arguments in between are the chapter number, section number, ...
  3961. % Chapters, in the main contents.
  3962. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  3963. %
  3964. % Chapters, in the short toc.
  3965. % See comments in \dochapentry re vbox and related settings.
  3966. \def\shortchapentry#1#2#3{%
  3967. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}%
  3968. }
  3969. % Appendices, in the main contents.
  3970. \def\appendixentry#1#2#3{%
  3971. \dochapentry{\appendixbox{\putwordAppendix{} #2}\labelspace#1}{#3}}
  3972. %
  3973. % Appendices, in the short toc.
  3974. \let\shortappendixentry = \shortchapentry
  3975. % Typeset the label for a chapter or appendix for the short contents.
  3976. % The arg is, e.g., `Appendix A' for an appendix, or `3' for a chapter.
  3977. % We could simplify the code here by writing out an \appendixentry
  3978. % command in the toc file for appendices, instead of using \chapentry
  3979. % for both, but it doesn't seem worth it.
  3980. %
  3981. \newdimen\shortappendixwidth
  3982. %
  3983. \def\shortchaplabel#1{%
  3984. % This space should be enough, since a single number is .5em, and the
  3985. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  3986. % But use \hss just in case.
  3987. % (This space doesn't include the extra space that gets added after
  3988. % the label; that gets put in by \shortchapentry above.)
  3989. \dimen0 = 1em
  3990. \hbox to \dimen0{#1\hss}%
  3991. }
  3992. % Unnumbered chapters.
  3993. \def\unnumbchapentry#1#2#3{\dochapentry{#1}{#3}}
  3994. \def\shortunnumberedentry#1#2#3{\tocentry{#1}{\doshortpageno\bgroup#3\egroup}}
  3995. % Sections.
  3996. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  3997. \def\unnumbsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  3998. % Subsections.
  3999. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  4000. \def\unnumbsubsecentry#1#2#3#4#5{\dosubsecentry{#1}{#5}}
  4001. % And subsubsections.
  4002. \def\subsubsecentry#1#2#3#4#5#6{%
  4003. \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  4004. \def\unnumbsubsubsecentry#1#2#3#4#5#6{\dosubsubsecentry{#1}{#6}}
  4005. % This parameter controls the indentation of the various levels.
  4006. \newdimen\tocindent \tocindent = 3pc
  4007. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  4008. % page number.
  4009. %
  4010. % If the toc has to be broken over pages, we want it to be at chapters
  4011. % if at all possible; hence the \penalty.
  4012. \def\dochapentry#1#2{%
  4013. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  4014. \begingroup
  4015. \chapentryfonts
  4016. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  4017. \endgroup
  4018. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  4019. }
  4020. \def\dosecentry#1#2{\begingroup
  4021. \secentryfonts \leftskip=\tocindent
  4022. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  4023. \endgroup}
  4024. \def\dosubsecentry#1#2{\begingroup
  4025. \subsecentryfonts \leftskip=2\tocindent
  4026. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  4027. \endgroup}
  4028. \def\dosubsubsecentry#1#2{\begingroup
  4029. \subsubsecentryfonts \leftskip=3\tocindent
  4030. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  4031. \endgroup}
  4032. % Final typesetting of a toc entry; we use the same \entry macro as for
  4033. % the index entries, but we want to suppress hyphenation here. (We
  4034. % can't do that in the \entry macro, since index entries might consist
  4035. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  4036. \def\tocentry#1#2{\begingroup
  4037. \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks
  4038. % Do not use \turnoffactive in these arguments. Since the toc is
  4039. % typeset in cmr, characters such as _ would come out wrong; we
  4040. % have to do the usual translation tricks.
  4041. \entry{#1}{#2}%
  4042. \endgroup}
  4043. % Space between chapter (or whatever) number and the title.
  4044. \def\labelspace{\hskip1em \relax}
  4045. \def\dopageno#1{{\rm #1}}
  4046. \def\doshortpageno#1{{\rm #1}}
  4047. \def\chapentryfonts{\secfonts \rm}
  4048. \def\secentryfonts{\textfonts}
  4049. \let\subsecentryfonts = \textfonts
  4050. \let\subsubsecentryfonts = \textfonts
  4051. \message{environments,}
  4052. % @foo ... @end foo.
  4053. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  4054. %
  4055. % Since these characters are used in examples, it should be an even number of
  4056. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  4057. %
  4058. \def\point{$\star$}
  4059. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  4060. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  4061. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  4062. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  4063. % The @error{} command.
  4064. % Adapted from the TeXbook's \boxit.
  4065. %
  4066. \newbox\errorbox
  4067. %
  4068. {\tentt \global\dimen0 = 3em}% Width of the box.
  4069. \dimen2 = .55pt % Thickness of rules
  4070. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  4071. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  4072. %
  4073. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  4074. \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  4075. \advance\hsize by -2\dimen2 % Rules.
  4076. \vbox{
  4077. \hrule height\dimen2
  4078. \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
  4079. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  4080. \kern3pt\vrule width\dimen2}% Space to right.
  4081. \hrule height\dimen2}
  4082. \hfil}
  4083. %
  4084. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  4085. % @tex ... @end tex escapes into raw Tex temporarily.
  4086. % One exception: @ is still an escape character, so that @end tex works.
  4087. % But \@ or @@ will get a plain tex @ character.
  4088. \def\tex{\begingroup
  4089. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  4090. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  4091. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  4092. \catcode `\%=14
  4093. \catcode `\+=\other
  4094. \catcode `\"=\other
  4095. \catcode `\==\other
  4096. \catcode `\|=\other
  4097. \catcode `\<=\other
  4098. \catcode `\>=\other
  4099. \escapechar=`\\
  4100. %
  4101. \let\b=\ptexb
  4102. \let\bullet=\ptexbullet
  4103. \let\c=\ptexc
  4104. \let\,=\ptexcomma
  4105. \let\.=\ptexdot
  4106. \let\dots=\ptexdots
  4107. \let\equiv=\ptexequiv
  4108. \let\!=\ptexexclam
  4109. \let\i=\ptexi
  4110. \let\indent=\ptexindent
  4111. \let\{=\ptexlbrace
  4112. \let\+=\tabalign
  4113. \let\}=\ptexrbrace
  4114. \let\/=\ptexslash
  4115. \let\*=\ptexstar
  4116. \let\t=\ptext
  4117. %
  4118. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  4119. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  4120. \def\@{@}%
  4121. \let\Etex=\endgroup}
  4122. % Define @lisp ... @end lisp.
  4123. % @lisp does a \begingroup so it can rebind things,
  4124. % including the definition of @end lisp (which normally is erroneous).
  4125. % Amount to narrow the margins by for @lisp.
  4126. \newskip\lispnarrowing \lispnarrowing=0.4in
  4127. % This is the definition that ^^M gets inside @lisp, @example, and other
  4128. % such environments. \null is better than a space, since it doesn't
  4129. % have any width.
  4130. \def\lisppar{\null\endgraf}
  4131. % Make each space character in the input produce a normal interword
  4132. % space in the output. Don't allow a line break at this space, as this
  4133. % is used only in environments like @example, where each line of input
  4134. % should produce a line of output anyway.
  4135. %
  4136. {\obeyspaces %
  4137. \gdef\sepspaces{\obeyspaces\let =\tie}}
  4138. % Define \obeyedspace to be our active space, whatever it is. This is
  4139. % for use in \parsearg.
  4140. {\sepspaces%
  4141. \global\let\obeyedspace= }
  4142. % This space is always present above and below environments.
  4143. \newskip\envskipamount \envskipamount = 0pt
  4144. % Make spacing and below environment symmetrical. We use \parskip here
  4145. % to help in doing that, since in @example-like environments \parskip
  4146. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  4147. % start of the next paragraph will insert \parskip.
  4148. %
  4149. \def\aboveenvbreak{{%
  4150. % =10000 instead of <10000 because of a special case in \itemzzz, q.v.
  4151. \ifnum \lastpenalty=10000 \else
  4152. \advance\envskipamount by \parskip
  4153. \endgraf
  4154. \ifdim\lastskip<\envskipamount
  4155. \removelastskip
  4156. % it's not a good place to break if the last penalty was \nobreak
  4157. % or better ...
  4158. \ifnum\lastpenalty>10000 \else \penalty-50 \fi
  4159. \vskip\envskipamount
  4160. \fi
  4161. \fi
  4162. }}
  4163. \let\afterenvbreak = \aboveenvbreak
  4164. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins.
  4165. \let\nonarrowing=\relax
  4166. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  4167. % environment contents.
  4168. \font\circle=lcircle10
  4169. \newdimen\circthick
  4170. \newdimen\cartouter\newdimen\cartinner
  4171. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  4172. \circthick=\fontdimen8\circle
  4173. %
  4174. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  4175. \def\ctr{{\hskip 6pt\circle\char'010}}
  4176. \def\cbl{{\circle\char'012\hskip -6pt}}
  4177. \def\cbr{{\hskip 6pt\circle\char'011}}
  4178. \def\carttop{\hbox to \cartouter{\hskip\lskip
  4179. \ctl\leaders\hrule height\circthick\hfil\ctr
  4180. \hskip\rskip}}
  4181. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  4182. \cbl\leaders\hrule height\circthick\hfil\cbr
  4183. \hskip\rskip}}
  4184. %
  4185. \newskip\lskip\newskip\rskip
  4186. \def\cartouche{%
  4187. \par % can't be in the midst of a paragraph.
  4188. \begingroup
  4189. \lskip=\leftskip \rskip=\rightskip
  4190. \leftskip=0pt\rightskip=0pt %we want these *outside*.
  4191. \cartinner=\hsize \advance\cartinner by-\lskip
  4192. \advance\cartinner by-\rskip
  4193. \cartouter=\hsize
  4194. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  4195. % side, and for 6pt waste from
  4196. % each corner char, and rule thickness
  4197. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  4198. % Flag to tell @lisp, etc., not to narrow margin.
  4199. \let\nonarrowing=\comment
  4200. \vbox\bgroup
  4201. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  4202. \carttop
  4203. \hbox\bgroup
  4204. \hskip\lskip
  4205. \vrule\kern3pt
  4206. \vbox\bgroup
  4207. \hsize=\cartinner
  4208. \kern3pt
  4209. \begingroup
  4210. \baselineskip=\normbskip
  4211. \lineskip=\normlskip
  4212. \parskip=\normpskip
  4213. \vskip -\parskip
  4214. \def\Ecartouche{%
  4215. \endgroup
  4216. \kern3pt
  4217. \egroup
  4218. \kern3pt\vrule
  4219. \hskip\rskip
  4220. \egroup
  4221. \cartbot
  4222. \egroup
  4223. \endgroup
  4224. }}
  4225. % This macro is called at the beginning of all the @example variants,
  4226. % inside a group.
  4227. \def\nonfillstart{%
  4228. \aboveenvbreak
  4229. \inENV % This group ends at the end of the body
  4230. \hfuzz = 12pt % Don't be fussy
  4231. \sepspaces % Make spaces be word-separators rather than space tokens.
  4232. \let\par = \lisppar % don't ignore blank lines
  4233. \obeylines % each line of input is a line of output
  4234. \parskip = 0pt
  4235. \parindent = 0pt
  4236. \emergencystretch = 0pt % don't try to avoid overfull boxes
  4237. % @cartouche defines \nonarrowing to inhibit narrowing
  4238. % at next level down.
  4239. \ifx\nonarrowing\relax
  4240. \advance \leftskip by \lispnarrowing
  4241. \exdentamount=\lispnarrowing
  4242. \let\exdent=\nofillexdent
  4243. \let\nonarrowing=\relax
  4244. \fi
  4245. }
  4246. % Define the \E... control sequence only if we are inside the particular
  4247. % environment, so the error checking in \end will work.
  4248. %
  4249. % To end an @example-like environment, we first end the paragraph (via
  4250. % \afterenvbreak's vertical glue), and then the group. That way we keep
  4251. % the zero \parskip that the environments set -- \parskip glue will be
  4252. % inserted at the beginning of the next paragraph in the document, after
  4253. % the environment.
  4254. %
  4255. \def\nonfillfinish{\afterenvbreak\endgroup}
  4256. % @lisp: indented, narrowed, typewriter font.
  4257. \def\lisp{\begingroup
  4258. \nonfillstart
  4259. \let\Elisp = \nonfillfinish
  4260. \tt
  4261. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  4262. \gobble % eat return
  4263. }
  4264. % @example: Same as @lisp.
  4265. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  4266. % @smallexample and @smalllisp: use smaller fonts.
  4267. % Originally contributed by Pavel@xerox.
  4268. \def\smalllisp{\begingroup
  4269. \def\Esmalllisp{\nonfillfinish\endgroup}%
  4270. \def\Esmallexample{\nonfillfinish\endgroup}%
  4271. \smallexamplefonts
  4272. \lisp
  4273. }
  4274. \let\smallexample = \smalllisp
  4275. % @display: same as @lisp except keep current font.
  4276. %
  4277. \def\display{\begingroup
  4278. \nonfillstart
  4279. \let\Edisplay = \nonfillfinish
  4280. \gobble
  4281. }
  4282. %
  4283. % @smalldisplay: @display plus smaller fonts.
  4284. %
  4285. \def\smalldisplay{\begingroup
  4286. \def\Esmalldisplay{\nonfillfinish\endgroup}%
  4287. \smallexamplefonts \rm
  4288. \display
  4289. }
  4290. % @format: same as @display except don't narrow margins.
  4291. %
  4292. \def\format{\begingroup
  4293. \let\nonarrowing = t
  4294. \nonfillstart
  4295. \let\Eformat = \nonfillfinish
  4296. \gobble
  4297. }
  4298. %
  4299. % @smallformat: @format plus smaller fonts.
  4300. %
  4301. \def\smallformat{\begingroup
  4302. \def\Esmallformat{\nonfillfinish\endgroup}%
  4303. \smallexamplefonts \rm
  4304. \format
  4305. }
  4306. % @flushleft (same as @format).
  4307. %
  4308. \def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format}
  4309. % @flushright.
  4310. %
  4311. \def\flushright{\begingroup
  4312. \let\nonarrowing = t
  4313. \nonfillstart
  4314. \let\Eflushright = \nonfillfinish
  4315. \advance\leftskip by 0pt plus 1fill
  4316. \gobble
  4317. }
  4318. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  4319. % and narrows the margins.
  4320. %
  4321. \def\quotation{%
  4322. \begingroup\inENV %This group ends at the end of the @quotation body
  4323. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  4324. \parindent=0pt
  4325. % We have retained a nonzero parskip for the environment, since we're
  4326. % doing normal filling. So to avoid extra space below the environment...
  4327. \def\Equotation{\parskip = 0pt \nonfillfinish}%
  4328. %
  4329. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  4330. \ifx\nonarrowing\relax
  4331. \advance\leftskip by \lispnarrowing
  4332. \advance\rightskip by \lispnarrowing
  4333. \exdentamount = \lispnarrowing
  4334. \let\nonarrowing = \relax
  4335. \fi
  4336. }
  4337. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  4338. % If we want to allow any <char> as delimiter,
  4339. % we need the curly braces so that makeinfo sees the @verb command, eg:
  4340. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  4341. %
  4342. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  4343. %
  4344. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  4345. % active too. Otherwise, they get lost as the first character on a
  4346. % verbatim line.
  4347. \def\dospecials{%
  4348. \do\ \do\\\do\{\do\}\do\$\do\&%
  4349. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  4350. \do\<\do\>\do\|\do\@\do+\do\"%
  4351. }
  4352. %
  4353. % [Knuth] p. 380
  4354. \def\uncatcodespecials{%
  4355. \def\do##1{\catcode`##1=12}\dospecials}
  4356. %
  4357. % [Knuth] pp. 380,381,391
  4358. % Disable Spanish ligatures ?` and !` of \tt font
  4359. \begingroup
  4360. \catcode`\`=\active\gdef`{\relax\lq}
  4361. \endgroup
  4362. %
  4363. % Setup for the @verb command.
  4364. %
  4365. % Eight spaces for a tab
  4366. \begingroup
  4367. \catcode`\^^I=\active
  4368. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  4369. \endgroup
  4370. %
  4371. \def\setupverb{%
  4372. \tt % easiest (and conventionally used) font for verbatim
  4373. \def\par{\leavevmode\endgraf}%
  4374. \catcode`\`=\active
  4375. \tabeightspaces
  4376. % Respect line breaks,
  4377. % print special symbols as themselves, and
  4378. % make each space count
  4379. % must do in this order:
  4380. \obeylines \uncatcodespecials \sepspaces
  4381. }
  4382. % Setup for the @verbatim environment
  4383. %
  4384. % Real tab expansion
  4385. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  4386. %
  4387. \def\starttabbox{\setbox0=\hbox\bgroup}
  4388. \begingroup
  4389. \catcode`\^^I=\active
  4390. \gdef\tabexpand{%
  4391. \catcode`\^^I=\active
  4392. \def^^I{\leavevmode\egroup
  4393. \dimen0=\wd0 % the width so far, or since the previous tab
  4394. \divide\dimen0 by\tabw
  4395. \multiply\dimen0 by\tabw % compute previous multiple of \tabw
  4396. \advance\dimen0 by\tabw % advance to next multiple of \tabw
  4397. \wd0=\dimen0 \box0 \starttabbox
  4398. }%
  4399. }
  4400. \endgroup
  4401. \def\setupverbatim{%
  4402. % Easiest (and conventionally used) font for verbatim
  4403. \tt
  4404. \def\par{\leavevmode\egroup\box0\endgraf}%
  4405. \catcode`\`=\active
  4406. \tabexpand
  4407. % Respect line breaks,
  4408. % print special symbols as themselves, and
  4409. % make each space count
  4410. % must do in this order:
  4411. \obeylines \uncatcodespecials \sepspaces
  4412. \everypar{\starttabbox}%
  4413. }
  4414. % Do the @verb magic: verbatim text is quoted by unique
  4415. % delimiter characters. Before first delimiter expect a
  4416. % right brace, after last delimiter expect closing brace:
  4417. %
  4418. % \def\doverb'{'<char>#1<char>'}'{#1}
  4419. %
  4420. % [Knuth] p. 382; only eat outer {}
  4421. \begingroup
  4422. \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12
  4423. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  4424. \endgroup
  4425. %
  4426. \def\verb{\begingroup\setupverb\doverb}
  4427. %
  4428. %
  4429. % Do the @verbatim magic: define the macro \doverbatim so that
  4430. % the (first) argument ends when '@end verbatim' is reached, ie:
  4431. %
  4432. % \def\doverbatim#1@end verbatim{#1}
  4433. %
  4434. % For Texinfo it's a lot easier than for LaTeX,
  4435. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  4436. % we need not redefine '\', '{' and '}'.
  4437. %
  4438. % Inspired by LaTeX's verbatim command set [latex.ltx]
  4439. %% Include LaTeX hack for completeness -- never know
  4440. %% \begingroup
  4441. %% \catcode`|=0 \catcode`[=1
  4442. %% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active
  4443. %% \catcode`\\=12|gdef|doverbatim#1@end verbatim[
  4444. %% #1|endgroup|def|Everbatim[]|end[verbatim]]
  4445. %% |endgroup
  4446. %
  4447. \begingroup
  4448. \catcode`\ =\active
  4449. \obeylines %
  4450. % ignore everything up to the first ^^M, that's the newline at the end
  4451. % of the @verbatim input line itself. Otherwise we get an extra blank
  4452. % line in the output.
  4453. \gdef\doverbatim#1^^M#2@end verbatim{#2\end{verbatim}}%
  4454. \endgroup
  4455. %
  4456. \def\verbatim{%
  4457. \def\Everbatim{\nonfillfinish\endgroup}%
  4458. \begingroup
  4459. \nonfillstart
  4460. \advance\leftskip by -\defbodyindent
  4461. \begingroup\setupverbatim\doverbatim
  4462. }
  4463. % @verbatiminclude FILE - insert text of file in verbatim environment.
  4464. %
  4465. % Allow normal characters that we make active in the argument (a file name).
  4466. \def\verbatiminclude{%
  4467. \begingroup
  4468. \catcode`\\=\other
  4469. \catcode`~=\other
  4470. \catcode`^=\other
  4471. \catcode`_=\other
  4472. \catcode`|=\other
  4473. \catcode`<=\other
  4474. \catcode`>=\other
  4475. \catcode`+=\other
  4476. \parsearg\doverbatiminclude
  4477. }
  4478. \def\setupverbatiminclude{%
  4479. \begingroup
  4480. \nonfillstart
  4481. \advance\leftskip by -\defbodyindent
  4482. \begingroup\setupverbatim
  4483. }
  4484. %
  4485. \def\doverbatiminclude#1{%
  4486. % Restore active chars for included file.
  4487. \endgroup
  4488. \begingroup
  4489. \let\value=\expandablevalue
  4490. \def\thisfile{#1}%
  4491. \expandafter\expandafter\setupverbatiminclude\input\thisfile
  4492. \endgroup
  4493. \nonfillfinish
  4494. \endgroup
  4495. }
  4496. % @copying ... @end copying.
  4497. % Save the text away for @insertcopying later. Many commands won't be
  4498. % allowed in this context, but that's ok.
  4499. %
  4500. % We save the uninterpreted tokens, rather than creating a box.
  4501. % Saving the text in a box would be much easier, but then all the
  4502. % typesetting commands (@smallbook, font changes, etc.) have to be done
  4503. % beforehand -- and a) we want @copying to be done first in the source
  4504. % file; b) letting users define the frontmatter in as flexible order as
  4505. % possible is very desirable.
  4506. %
  4507. \def\copying{\begingroup
  4508. % Define a command to swallow text until we reach `@end copying'.
  4509. % \ is the escape char in this texinfo.tex file, so it is the
  4510. % delimiter for the command; @ will be the escape char when we read
  4511. % it, but that doesn't matter.
  4512. \long\def\docopying##1\end copying{\gdef\copyingtext{##1}\enddocopying}%
  4513. %
  4514. % We must preserve ^^M's in the input file; see \insertcopying below.
  4515. \catcode`\^^M = \active
  4516. \docopying
  4517. }
  4518. % What we do to finish off the copying text.
  4519. %
  4520. \def\enddocopying{\endgroup\ignorespaces}
  4521. % @insertcopying. Here we must play games with ^^M's. On the one hand,
  4522. % we need them to delimit commands such as `@end quotation', so they
  4523. % must be active. On the other hand, we certainly don't want every
  4524. % end-of-line to be a \par, as would happen with the normal active
  4525. % definition of ^^M. On the third hand, two ^^M's in a row should still
  4526. % generate a \par.
  4527. %
  4528. % Our approach is to make ^^M insert a space and a penalty1 normally;
  4529. % then it can also check if \lastpenalty=1. If it does, then manually
  4530. % do \par.
  4531. %
  4532. % This messes up the normal definitions of @c[omment], so we redefine
  4533. % it. Similarly for @ignore. (These commands are used in the gcc
  4534. % manual for man page generation.)
  4535. %
  4536. % Seems pretty fragile, most line-oriented commands will presumably
  4537. % fail, but for the limited use of getting the copying text (which
  4538. % should be quite simple) inserted, we can hope it's ok.
  4539. %
  4540. {\catcode`\^^M=\active %
  4541. \gdef\insertcopying{\begingroup %
  4542. \parindent = 0pt % looks wrong on title page
  4543. \def^^M{%
  4544. \ifnum \lastpenalty=1 %
  4545. \par %
  4546. \else %
  4547. \space \penalty 1 %
  4548. \fi %
  4549. }%
  4550. %
  4551. % Fix @c[omment] for catcode 13 ^^M's.
  4552. \def\c##1^^M{\ignorespaces}%
  4553. \let\comment = \c %
  4554. %
  4555. % Don't bother jumping through all the hoops that \doignore does, it
  4556. % would be very hard since the catcodes are already set.
  4557. \long\def\ignore##1\end ignore{\ignorespaces}%
  4558. %
  4559. \copyingtext %
  4560. \endgroup}%
  4561. }
  4562. \message{defuns,}
  4563. % @defun etc.
  4564. % Allow user to change definition object font (\df) internally
  4565. \def\setdeffont#1 {\csname DEF#1\endcsname}
  4566. \newskip\defbodyindent \defbodyindent=.4in
  4567. \newskip\defargsindent \defargsindent=50pt
  4568. \newskip\deflastargmargin \deflastargmargin=18pt
  4569. \newcount\parencount
  4570. % We want ()&[] to print specially on the defun line.
  4571. %
  4572. \def\activeparens{%
  4573. \catcode`\(=\active \catcode`\)=\active
  4574. \catcode`\&=\active
  4575. \catcode`\[=\active \catcode`\]=\active
  4576. }
  4577. % Make control sequences which act like normal parenthesis chars.
  4578. \let\lparen = ( \let\rparen = )
  4579. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  4580. % Be sure that we always have a definition for `(', etc. For example,
  4581. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  4582. % so TeX would otherwise complain about undefined control sequence.
  4583. \global\let(=\lparen \global\let)=\rparen
  4584. \global\let[=\lbrack \global\let]=\rbrack
  4585. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  4586. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  4587. % This is used to turn on special parens
  4588. % but make & act ordinary (given that it's active).
  4589. \gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr}
  4590. % Definitions of (, ) and & used in args for functions.
  4591. % This is the definition of ( outside of all parentheses.
  4592. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested
  4593. \global\advance\parencount by 1
  4594. }
  4595. %
  4596. % This is the definition of ( when already inside a level of parens.
  4597. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  4598. %
  4599. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  4600. % also in that case restore the outer-level definition of (.
  4601. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  4602. \global\advance \parencount by -1 }
  4603. % If we encounter &foo, then turn on ()-hacking afterwards
  4604. \gdef\amprm#1 {{\rm\&#1}\let(=\oprm \let)=\clrm\ }
  4605. %
  4606. \gdef\normalparens{\boldbrax\let&=\ampnr}
  4607. } % End of definition inside \activeparens
  4608. %% These parens (in \boldbrax) actually are a little bolder than the
  4609. %% contained text. This is especially needed for [ and ]
  4610. \def\opnr{{\sf\char`\(}\global\advance\parencount by 1 }
  4611. \def\clnr{{\sf\char`\)}\global\advance\parencount by -1 }
  4612. \let\ampnr = \&
  4613. \def\lbrb{{\bf\char`\[}}
  4614. \def\rbrb{{\bf\char`\]}}
  4615. % Active &'s sneak into the index arguments, so make sure it's defined.
  4616. {
  4617. \catcode`& = \active
  4618. \global\let& = \ampnr
  4619. }
  4620. % \defname, which formats the name of the @def (not the args).
  4621. % #1 is the function name.
  4622. % #2 is the type of definition, such as "Function".
  4623. %
  4624. \def\defname#1#2{%
  4625. % How we'll output the type name. Putting it in brackets helps
  4626. % distinguish it from the body text that may end up on the next line
  4627. % just below it.
  4628. \ifempty{#2}%
  4629. \def\defnametype{}%
  4630. \else
  4631. \def\defnametype{[\rm #2]}%
  4632. \fi
  4633. %
  4634. % Get the values of \leftskip and \rightskip as they were outside the @def...
  4635. \dimen2=\leftskip
  4636. \advance\dimen2 by -\defbodyindent
  4637. %
  4638. % Figure out values for the paragraph shape.
  4639. \setbox0=\hbox{\hskip \deflastargmargin{\defnametype}}%
  4640. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  4641. \dimen1=\hsize \advance \dimen1 by -\defargsindent % size for continuations
  4642. \parshape 2 0in \dimen0 \defargsindent \dimen1
  4643. %
  4644. % Output arg 2 ("Function" or some such) but stuck inside a box of
  4645. % width 0 so it does not interfere with linebreaking.
  4646. \noindent
  4647. %
  4648. {% Adjust \hsize to exclude the ambient margins,
  4649. % so that \rightline will obey them.
  4650. \advance \hsize by -\dimen2
  4651. \dimen3 = 0pt % was -1.25pc
  4652. \rlap{\rightline{\defnametype\kern\dimen3}}%
  4653. }%
  4654. %
  4655. % Allow all lines to be underfull without complaint:
  4656. \tolerance=10000 \hbadness=10000
  4657. \advance\leftskip by -\defbodyindent
  4658. \exdentamount=\defbodyindent
  4659. {\df #1}\enskip % output function name
  4660. % \defunargs will be called next to output the arguments, if any.
  4661. }
  4662. % Common pieces to start any @def...
  4663. % #1 is the \E... control sequence to end the definition (which we define).
  4664. % #2 is the \...x control sequence (which our caller defines).
  4665. % #3 is the control sequence to process the header, such as \defunheader.
  4666. %
  4667. \def\parsebodycommon#1#2#3{%
  4668. \begingroup\inENV
  4669. % If there are two @def commands in a row, we'll have a \nobreak,
  4670. % which is there to keep the function description together with its
  4671. % header. But if there's nothing but headers, we want to allow a
  4672. % break after all. Check for penalty 10002 (inserted by
  4673. % \defargscommonending) instead of 10000, since the sectioning
  4674. % commands insert a \penalty10000, and we don't want to allow a break
  4675. % between a section heading and a defun.
  4676. \ifnum\lastpenalty=10002 \penalty0 \fi
  4677. \medbreak
  4678. %
  4679. % Define the \E... end token that this defining construct specifies
  4680. % so that it will exit this group.
  4681. \def#1{\endgraf\endgroup\medbreak}%
  4682. %
  4683. \parindent=0in
  4684. \advance\leftskip by \defbodyindent
  4685. \exdentamount=\defbodyindent
  4686. }
  4687. % Common part of the \...x definitions.
  4688. %
  4689. \def\defxbodycommon{%
  4690. % As with \parsebodycommon above, allow line break if we have multiple
  4691. % x headers in a row. It's not a great place, though.
  4692. \ifnum\lastpenalty=10000 \penalty1000 \fi
  4693. %
  4694. \begingroup\obeylines
  4695. }
  4696. % Process body of @defun, @deffn, @defmac, etc.
  4697. %
  4698. \def\defparsebody#1#2#3{%
  4699. \parsebodycommon{#1}{#2}{#3}%
  4700. \def#2{\defxbodycommon \activeparens \spacesplit#3}%
  4701. \catcode\equalChar=\active
  4702. \begingroup\obeylines\activeparens
  4703. \spacesplit#3%
  4704. }
  4705. % #1, #2, #3 are the common arguments (see \parsebodycommon above).
  4706. % #4, delimited by the space, is the class name.
  4707. %
  4708. \def\defmethparsebody#1#2#3#4 {%
  4709. \parsebodycommon{#1}{#2}{#3}%
  4710. \def#2##1 {\defxbodycommon \activeparens \spacesplit{#3{##1}}}%
  4711. \begingroup\obeylines\activeparens
  4712. % The \empty here prevents misinterpretation of a construct such as
  4713. % @deffn {whatever} {Enharmonic comma}
  4714. % See comments at \deftpparsebody, although in our case we don't have
  4715. % to remove the \empty afterwards, since it is empty.
  4716. \spacesplit{#3{#4}}\empty
  4717. }
  4718. % Used for @deftypemethod and @deftypeivar.
  4719. % #1, #2, #3 are the common arguments (see \defparsebody).
  4720. % #4, delimited by a space, is the class name.
  4721. % #5 is the method's return type.
  4722. %
  4723. \def\deftypemethparsebody#1#2#3#4 #5 {%
  4724. \parsebodycommon{#1}{#2}{#3}%
  4725. \def#2##1 ##2 {\defxbodycommon \activeparens \spacesplit{#3{##1}{##2}}}%
  4726. \begingroup\obeylines\activeparens
  4727. \spacesplit{#3{#4}{#5}}%
  4728. }
  4729. % Used for @deftypeop. The change from \deftypemethparsebody is an
  4730. % extra argument at the beginning which is the `category', instead of it
  4731. % being the hardwired string `Method' or `Instance Variable'. We have
  4732. % to account for this both in the \...x definition and in parsing the
  4733. % input at hand. Thus also need a control sequence (passed as #5) for
  4734. % the \E... definition to assign the category name to.
  4735. %
  4736. \def\deftypeopparsebody#1#2#3#4#5 #6 {%
  4737. \parsebodycommon{#1}{#2}{#3}%
  4738. \def#2##1 ##2 ##3 {\def#4{##1}%
  4739. \defxbodycommon \activeparens \spacesplit{#3{##2}{##3}}}%
  4740. \begingroup\obeylines\activeparens
  4741. \spacesplit{#3{#5}{#6}}%
  4742. }
  4743. % For @defop.
  4744. \def\defopparsebody #1#2#3#4#5 {%
  4745. \parsebodycommon{#1}{#2}{#3}%
  4746. \def#2##1 ##2 {\def#4{##1}%
  4747. \defxbodycommon \activeparens \spacesplit{#3{##2}}}%
  4748. \begingroup\obeylines\activeparens
  4749. \spacesplit{#3{#5}}%
  4750. }
  4751. % These parsing functions are similar to the preceding ones
  4752. % except that they do not make parens into active characters.
  4753. % These are used for "variables" since they have no arguments.
  4754. %
  4755. \def\defvarparsebody #1#2#3{%
  4756. \parsebodycommon{#1}{#2}{#3}%
  4757. \def#2{\defxbodycommon \spacesplit#3}%
  4758. \catcode\equalChar=\active
  4759. \begingroup\obeylines
  4760. \spacesplit#3%
  4761. }
  4762. % @defopvar.
  4763. \def\defopvarparsebody #1#2#3#4#5 {%
  4764. \parsebodycommon{#1}{#2}{#3}%
  4765. \def#2##1 ##2 {\def#4{##1}%
  4766. \defxbodycommon \spacesplit{#3{##2}}}%
  4767. \begingroup\obeylines
  4768. \spacesplit{#3{#5}}%
  4769. }
  4770. \def\defvrparsebody#1#2#3#4 {%
  4771. \parsebodycommon{#1}{#2}{#3}%
  4772. \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
  4773. \begingroup\obeylines
  4774. \spacesplit{#3{#4}}%
  4775. }
  4776. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  4777. % type is just `struct', because we lose the braces in `{struct
  4778. % termios}' when \spacesplit reads its undelimited argument. Sigh.
  4779. % \let\deftpparsebody=\defvrparsebody
  4780. %
  4781. % So, to get around this, we put \empty in with the type name. That
  4782. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  4783. % won't strip off the braces.
  4784. %
  4785. \def\deftpparsebody #1#2#3#4 {%
  4786. \parsebodycommon{#1}{#2}{#3}%
  4787. \def#2##1 {\defxbodycommon \spacesplit{#3{##1}}}%
  4788. \begingroup\obeylines
  4789. \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  4790. }
  4791. % Fine, but then we have to eventually remove the \empty *and* the
  4792. % braces (if any). That's what this does.
  4793. %
  4794. \def\removeemptybraces\empty#1\relax{#1}
  4795. % After \spacesplit has done its work, this is called -- #1 is the final
  4796. % thing to call, #2 the type name (which starts with \empty), and #3
  4797. % (which might be empty) the arguments.
  4798. %
  4799. \def\parsetpheaderline#1#2#3{%
  4800. #1{\removeemptybraces#2\relax}{#3}%
  4801. }%
  4802. % Split up #2 (the rest of the input line) at the first space token.
  4803. % call #1 with two arguments:
  4804. % the first is all of #2 before the space token,
  4805. % the second is all of #2 after that space token.
  4806. % If #2 contains no space token, all of it is passed as the first arg
  4807. % and the second is passed as empty.
  4808. %
  4809. {\obeylines %
  4810. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitx{#1}#2 \relax\spacesplitx}%
  4811. \long\gdef\spacesplitx#1#2 #3#4\spacesplitx{%
  4812. \ifx\relax #3%
  4813. #1{#2}{}%
  4814. \else %
  4815. #1{#2}{#3#4}%
  4816. \fi}%
  4817. }
  4818. % Define @defun.
  4819. % This is called to end the arguments processing for all the @def... commands.
  4820. %
  4821. \def\defargscommonending{%
  4822. \interlinepenalty = 10000
  4823. \advance\rightskip by 0pt plus 1fil
  4824. \endgraf
  4825. \nobreak\vskip -\parskip
  4826. \penalty 10002 % signal to \parsebodycommon.
  4827. }
  4828. % This expands the args and terminates the paragraph they comprise.
  4829. %
  4830. \def\defunargs#1{\functionparens \sl
  4831. % Expand, preventing hyphenation at `-' chars.
  4832. % Note that groups don't affect changes in \hyphenchar.
  4833. % Set the font temporarily and use \font in case \setfont made \tensl a macro.
  4834. {\tensl\hyphenchar\font=0}%
  4835. #1%
  4836. {\tensl\hyphenchar\font=45}%
  4837. \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi%
  4838. \defargscommonending
  4839. }
  4840. \def\deftypefunargs #1{%
  4841. % Expand, preventing hyphenation at `-' chars.
  4842. % Note that groups don't affect changes in \hyphenchar.
  4843. % Use \boldbraxnoamp, not \functionparens, so that & is not special.
  4844. \boldbraxnoamp
  4845. \tclose{#1}% avoid \code because of side effects on active chars
  4846. \defargscommonending
  4847. }
  4848. % Do complete processing of one @defun or @defunx line already parsed.
  4849. % @deffn Command forward-char nchars
  4850. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  4851. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  4852. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  4853. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4854. }
  4855. % @defun == @deffn Function
  4856. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  4857. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  4858. \begingroup\defname {#1}{\putwordDeffunc}%
  4859. \defunargs {#2}\endgroup %
  4860. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4861. }
  4862. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  4863. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  4864. % #1 is the data type. #2 is the name and args.
  4865. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  4866. % #1 is the data type, #2 the name, #3 the args.
  4867. \def\deftypefunheaderx #1#2 #3\relax{%
  4868. \doind {fn}{\code{#2}}% Make entry in function index
  4869. \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}%
  4870. \deftypefunargs {#3}\endgroup %
  4871. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4872. }
  4873. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  4874. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  4875. % \defheaderxcond#1\relax$.$
  4876. % puts #1 in @code, followed by a space, but does nothing if #1 is null.
  4877. \def\defheaderxcond#1#2$.${\ifx#1\relax\else\code{#1#2} \fi}
  4878. % #1 is the classification. #2 is the data type. #3 is the name and args.
  4879. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  4880. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  4881. \def\deftypefnheaderx #1#2#3 #4\relax{%
  4882. \doind {fn}{\code{#3}}% Make entry in function index
  4883. \begingroup
  4884. \normalparens % notably, turn off `&' magic, which prevents
  4885. % at least some C++ text from working
  4886. \defname {\defheaderxcond#2\relax$.$#3}{#1}%
  4887. \deftypefunargs {#4}\endgroup %
  4888. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4889. }
  4890. % @defmac == @deffn Macro
  4891. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  4892. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  4893. \begingroup\defname {#1}{\putwordDefmac}%
  4894. \defunargs {#2}\endgroup %
  4895. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4896. }
  4897. % @defspec == @deffn Special Form
  4898. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  4899. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  4900. \begingroup\defname {#1}{\putwordDefspec}%
  4901. \defunargs {#2}\endgroup %
  4902. \catcode\equalChar=\other % Turn off change made in \defparsebody
  4903. }
  4904. % @defop CATEGORY CLASS OPERATION ARG...
  4905. %
  4906. \def\defop #1 {\def\defoptype{#1}%
  4907. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  4908. %
  4909. \def\defopheader#1#2#3{%
  4910. \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry
  4911. \begingroup
  4912. \defname{#2}{\defoptype\ \putwordon\ #1}%
  4913. \defunargs{#3}%
  4914. \endgroup
  4915. }
  4916. % @deftypeop CATEGORY CLASS TYPE OPERATION ARG...
  4917. %
  4918. \def\deftypeop #1 {\def\deftypeopcategory{#1}%
  4919. \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader
  4920. \deftypeopcategory}
  4921. %
  4922. % #1 is the class name, #2 the data type, #3 the operation name, #4 the args.
  4923. \def\deftypeopheader#1#2#3#4{%
  4924. \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  4925. \begingroup
  4926. \defname{\defheaderxcond#2\relax$.$#3}
  4927. {\deftypeopcategory\ \putwordon\ \code{#1}}%
  4928. \deftypefunargs{#4}%
  4929. \endgroup
  4930. }
  4931. % @deftypemethod CLASS TYPE METHOD ARG...
  4932. %
  4933. \def\deftypemethod{%
  4934. \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader}
  4935. %
  4936. % #1 is the class name, #2 the data type, #3 the method name, #4 the args.
  4937. \def\deftypemethodheader#1#2#3#4{%
  4938. \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index
  4939. \begingroup
  4940. \defname{\defheaderxcond#2\relax$.$#3}{\putwordMethodon\ \code{#1}}%
  4941. \deftypefunargs{#4}%
  4942. \endgroup
  4943. }
  4944. % @deftypeivar CLASS TYPE VARNAME
  4945. %
  4946. \def\deftypeivar{%
  4947. \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader}
  4948. %
  4949. % #1 is the class name, #2 the data type, #3 the variable name.
  4950. \def\deftypeivarheader#1#2#3{%
  4951. \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index
  4952. \begingroup
  4953. \defname{\defheaderxcond#2\relax$.$#3}
  4954. {\putwordInstanceVariableof\ \code{#1}}%
  4955. \defvarargs{#3}%
  4956. \endgroup
  4957. }
  4958. % @defmethod == @defop Method
  4959. %
  4960. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  4961. %
  4962. % #1 is the class name, #2 the method name, #3 the args.
  4963. \def\defmethodheader#1#2#3{%
  4964. \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index
  4965. \begingroup
  4966. \defname{#2}{\putwordMethodon\ \code{#1}}%
  4967. \defunargs{#3}%
  4968. \endgroup
  4969. }
  4970. % @defcv {Class Option} foo-class foo-flag
  4971. \def\defcv #1 {\def\defcvtype{#1}%
  4972. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  4973. \def\defcvarheader #1#2#3{%
  4974. \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry
  4975. \begingroup
  4976. \defname{#2}{\defcvtype\ \putwordof\ #1}%
  4977. \defvarargs{#3}%
  4978. \endgroup
  4979. }
  4980. % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME
  4981. %
  4982. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  4983. %
  4984. \def\defivarheader#1#2#3{%
  4985. \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index
  4986. \begingroup
  4987. \defname{#2}{\putwordInstanceVariableof\ #1}%
  4988. \defvarargs{#3}%
  4989. \endgroup
  4990. }
  4991. % @defvar
  4992. % First, define the processing that is wanted for arguments of @defvar.
  4993. % This is actually simple: just print them in roman.
  4994. % This must expand the args and terminate the paragraph they make up
  4995. \def\defvarargs #1{\normalparens #1%
  4996. \defargscommonending
  4997. }
  4998. % @defvr Counter foo-count
  4999. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  5000. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  5001. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  5002. % @defvar == @defvr Variable
  5003. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  5004. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  5005. \begingroup\defname {#1}{\putwordDefvar}%
  5006. \defvarargs {#2}\endgroup %
  5007. }
  5008. % @defopt == @defvr {User Option}
  5009. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  5010. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  5011. \begingroup\defname {#1}{\putwordDefopt}%
  5012. \defvarargs {#2}\endgroup %
  5013. }
  5014. % @deftypevar int foobar
  5015. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  5016. % #1 is the data type. #2 is the name, perhaps followed by text that
  5017. % is actually part of the data type, which should not be put into the index.
  5018. \def\deftypevarheader #1#2{%
  5019. \dovarind#2 \relax% Make entry in variables index
  5020. \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}%
  5021. \defargscommonending
  5022. \endgroup}
  5023. \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}}
  5024. % @deftypevr {Global Flag} int enable
  5025. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  5026. \def\deftypevrheader #1#2#3{\dovarind#3 \relax%
  5027. \begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1}
  5028. \defargscommonending
  5029. \endgroup}
  5030. % Now define @deftp
  5031. % Args are printed in bold, a slight difference from @defvar.
  5032. \def\deftpargs #1{\bf \defvarargs{#1}}
  5033. % @deftp Class window height width ...
  5034. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  5035. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  5036. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  5037. % These definitions are used if you use @defunx (etc.)
  5038. % anywhere other than immediately after a @defun or @defunx.
  5039. %
  5040. \def\defcvx#1 {\errmessage{@defcvx in invalid context}}
  5041. \def\deffnx#1 {\errmessage{@deffnx in invalid context}}
  5042. \def\defivarx#1 {\errmessage{@defivarx in invalid context}}
  5043. \def\defmacx#1 {\errmessage{@defmacx in invalid context}}
  5044. \def\defmethodx#1 {\errmessage{@defmethodx in invalid context}}
  5045. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  5046. \def\defopx#1 {\errmessage{@defopx in invalid context}}
  5047. \def\defspecx#1 {\errmessage{@defspecx in invalid context}}
  5048. \def\deftpx#1 {\errmessage{@deftpx in invalid context}}
  5049. \def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}}
  5050. \def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}}
  5051. \def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}}
  5052. \def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}}
  5053. \def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}}
  5054. \def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}}
  5055. \def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}}
  5056. \def\defunx#1 {\errmessage{@defunx in invalid context}}
  5057. \def\defvarx#1 {\errmessage{@defvarx in invalid context}}
  5058. \def\defvrx#1 {\errmessage{@defvrx in invalid context}}
  5059. \message{macros,}
  5060. % @macro.
  5061. % To do this right we need a feature of e-TeX, \scantokens,
  5062. % which we arrange to emulate with a temporary file in ordinary TeX.
  5063. \ifx\eTeXversion\undefined
  5064. \newwrite\macscribble
  5065. \def\scanmacro#1{%
  5066. \begingroup \newlinechar`\^^M
  5067. % Undo catcode changes of \startcontents and \doprintindex
  5068. \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  5069. % Append \endinput to make sure that TeX does not see the ending newline.
  5070. \toks0={#1\endinput}%
  5071. \immediate\openout\macscribble=\jobname.tmp
  5072. \immediate\write\macscribble{\the\toks0}%
  5073. \immediate\closeout\macscribble
  5074. \let\xeatspaces\eatspaces
  5075. \input \jobname.tmp
  5076. \endgroup
  5077. }
  5078. \else
  5079. \def\scanmacro#1{%
  5080. \begingroup \newlinechar`\^^M
  5081. % Undo catcode changes of \startcontents and \doprintindex
  5082. \catcode`\@=0 \catcode`\\=\other \escapechar=`\@
  5083. \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup}
  5084. \fi
  5085. \newcount\paramno % Count of parameters
  5086. \newtoks\macname % Macro name
  5087. \newif\ifrecursive % Is it recursive?
  5088. \def\macrolist{} % List of all defined macros in the form
  5089. % \do\macro1\do\macro2...
  5090. % Utility routines.
  5091. % Thisdoes \let #1 = #2, except with \csnames.
  5092. \def\cslet#1#2{%
  5093. \expandafter\expandafter
  5094. \expandafter\let
  5095. \expandafter\expandafter
  5096. \csname#1\endcsname
  5097. \csname#2\endcsname}
  5098. % Trim leading and trailing spaces off a string.
  5099. % Concepts from aro-bend problem 15 (see CTAN).
  5100. {\catcode`\@=11
  5101. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  5102. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  5103. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  5104. \def\unbrace#1{#1}
  5105. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  5106. }
  5107. % Trim a single trailing ^^M off a string.
  5108. {\catcode`\^^M=\other \catcode`\Q=3%
  5109. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  5110. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  5111. \gdef\eatcrb#1Q#2Q{#1}%
  5112. }
  5113. % Macro bodies are absorbed as an argument in a context where
  5114. % all characters are catcode 10, 11 or 12, except \ which is active
  5115. % (as in normal texinfo). It is necessary to change the definition of \.
  5116. % It's necessary to have hard CRs when the macro is executed. This is
  5117. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  5118. % body, and then making it the \newlinechar in \scanmacro.
  5119. \def\macrobodyctxt{%
  5120. \catcode`\~=\other
  5121. \catcode`\^=\other
  5122. \catcode`\_=\other
  5123. \catcode`\|=\other
  5124. \catcode`\<=\other
  5125. \catcode`\>=\other
  5126. \catcode`\+=\other
  5127. \catcode`\{=\other
  5128. \catcode`\}=\other
  5129. \catcode`\@=\other
  5130. \catcode`\^^M=\other
  5131. \usembodybackslash}
  5132. \def\macroargctxt{%
  5133. \catcode`\~=\other
  5134. \catcode`\^=\other
  5135. \catcode`\_=\other
  5136. \catcode`\|=\other
  5137. \catcode`\<=\other
  5138. \catcode`\>=\other
  5139. \catcode`\+=\other
  5140. \catcode`\@=\other
  5141. \catcode`\\=\other}
  5142. % \mbodybackslash is the definition of \ in @macro bodies.
  5143. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  5144. % where N is the macro parameter number.
  5145. % We define \csname macarg.\endcsname to be \realbackslash, so
  5146. % \\ in macro replacement text gets you a backslash.
  5147. {\catcode`@=0 @catcode`@\=@active
  5148. @gdef@usembodybackslash{@let\=@mbodybackslash}
  5149. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  5150. }
  5151. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  5152. \def\macro{\recursivefalse\parsearg\macroxxx}
  5153. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  5154. \def\macroxxx#1{%
  5155. \getargs{#1}% now \macname is the macname and \argl the arglist
  5156. \ifx\argl\empty % no arguments
  5157. \paramno=0%
  5158. \else
  5159. \expandafter\parsemargdef \argl;%
  5160. \fi
  5161. \if1\csname ismacro.\the\macname\endcsname
  5162. \message{Warning: redefining \the\macname}%
  5163. \else
  5164. \expandafter\ifx\csname \the\macname\endcsname \relax
  5165. \else \errmessage{Macro name \the\macname\space already defined}\fi
  5166. \global\cslet{macsave.\the\macname}{\the\macname}%
  5167. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  5168. % Add the macroname to \macrolist
  5169. \toks0 = \expandafter{\macrolist\do}%
  5170. \xdef\macrolist{\the\toks0
  5171. \expandafter\noexpand\csname\the\macname\endcsname}%
  5172. \fi
  5173. \begingroup \macrobodyctxt
  5174. \ifrecursive \expandafter\parsermacbody
  5175. \else \expandafter\parsemacbody
  5176. \fi}
  5177. \def\unmacro{\parsearg\dounmacro}
  5178. \def\dounmacro#1{%
  5179. \if1\csname ismacro.#1\endcsname
  5180. \global\cslet{#1}{macsave.#1}%
  5181. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  5182. % Remove the macro name from \macrolist:
  5183. \begingroup
  5184. \expandafter\let\csname#1\endcsname \relax
  5185. \let\do\unmacrodo
  5186. \xdef\macrolist{\macrolist}%
  5187. \endgroup
  5188. \else
  5189. \errmessage{Macro #1 not defined}%
  5190. \fi
  5191. }
  5192. % Called by \do from \dounmacro on each macro. The idea is to omit any
  5193. % macro definitions that have been changed to \relax.
  5194. %
  5195. \def\unmacrodo#1{%
  5196. \ifx#1\relax
  5197. % remove this
  5198. \else
  5199. \noexpand\do \noexpand #1%
  5200. \fi
  5201. }
  5202. % This makes use of the obscure feature that if the last token of a
  5203. % <parameter list> is #, then the preceding argument is delimited by
  5204. % an opening brace, and that opening brace is not consumed.
  5205. \def\getargs#1{\getargsxxx#1{}}
  5206. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  5207. \def\getmacname #1 #2\relax{\macname={#1}}
  5208. \def\getmacargs#1{\def\argl{#1}}
  5209. % Parse the optional {params} list. Set up \paramno and \paramlist
  5210. % so \defmacro knows what to do. Define \macarg.blah for each blah
  5211. % in the params list, to be ##N where N is the position in that list.
  5212. % That gets used by \mbodybackslash (above).
  5213. % We need to get `macro parameter char #' into several definitions.
  5214. % The technique used is stolen from LaTeX: let \hash be something
  5215. % unexpandable, insert that wherever you need a #, and then redefine
  5216. % it to # just before using the token list produced.
  5217. %
  5218. % The same technique is used to protect \eatspaces till just before
  5219. % the macro is used.
  5220. \def\parsemargdef#1;{\paramno=0\def\paramlist{}%
  5221. \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
  5222. \def\parsemargdefxxx#1,{%
  5223. \if#1;\let\next=\relax
  5224. \else \let\next=\parsemargdefxxx
  5225. \advance\paramno by 1%
  5226. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  5227. {\xeatspaces{\hash\the\paramno}}%
  5228. \edef\paramlist{\paramlist\hash\the\paramno,}%
  5229. \fi\next}
  5230. % These two commands read recursive and nonrecursive macro bodies.
  5231. % (They're different since rec and nonrec macros end differently.)
  5232. \long\def\parsemacbody#1@end macro%
  5233. {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  5234. \long\def\parsermacbody#1@end rmacro%
  5235. {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}%
  5236. % This defines the macro itself. There are six cases: recursive and
  5237. % nonrecursive macros of zero, one, and many arguments.
  5238. % Much magic with \expandafter here.
  5239. % \xdef is used so that macro definitions will survive the file
  5240. % they're defined in; @include reads the file inside a group.
  5241. \def\defmacro{%
  5242. \let\hash=##% convert placeholders to macro parameter chars
  5243. \ifrecursive
  5244. \ifcase\paramno
  5245. % 0
  5246. \expandafter\xdef\csname\the\macname\endcsname{%
  5247. \noexpand\scanmacro{\temp}}%
  5248. \or % 1
  5249. \expandafter\xdef\csname\the\macname\endcsname{%
  5250. \bgroup\noexpand\macroargctxt
  5251. \noexpand\braceorline
  5252. \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  5253. \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  5254. \egroup\noexpand\scanmacro{\temp}}%
  5255. \else % many
  5256. \expandafter\xdef\csname\the\macname\endcsname{%
  5257. \bgroup\noexpand\macroargctxt
  5258. \noexpand\csname\the\macname xx\endcsname}%
  5259. \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  5260. \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  5261. \expandafter\expandafter
  5262. \expandafter\xdef
  5263. \expandafter\expandafter
  5264. \csname\the\macname xxx\endcsname
  5265. \paramlist{\egroup\noexpand\scanmacro{\temp}}%
  5266. \fi
  5267. \else
  5268. \ifcase\paramno
  5269. % 0
  5270. \expandafter\xdef\csname\the\macname\endcsname{%
  5271. \noexpand\norecurse{\the\macname}%
  5272. \noexpand\scanmacro{\temp}\egroup}%
  5273. \or % 1
  5274. \expandafter\xdef\csname\the\macname\endcsname{%
  5275. \bgroup\noexpand\macroargctxt
  5276. \noexpand\braceorline
  5277. \expandafter\noexpand\csname\the\macname xxx\endcsname}%
  5278. \expandafter\xdef\csname\the\macname xxx\endcsname##1{%
  5279. \egroup
  5280. \noexpand\norecurse{\the\macname}%
  5281. \noexpand\scanmacro{\temp}\egroup}%
  5282. \else % many
  5283. \expandafter\xdef\csname\the\macname\endcsname{%
  5284. \bgroup\noexpand\macroargctxt
  5285. \expandafter\noexpand\csname\the\macname xx\endcsname}%
  5286. \expandafter\xdef\csname\the\macname xx\endcsname##1{%
  5287. \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}%
  5288. \expandafter\expandafter
  5289. \expandafter\xdef
  5290. \expandafter\expandafter
  5291. \csname\the\macname xxx\endcsname
  5292. \paramlist{%
  5293. \egroup
  5294. \noexpand\norecurse{\the\macname}%
  5295. \noexpand\scanmacro{\temp}\egroup}%
  5296. \fi
  5297. \fi}
  5298. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  5299. % \braceorline decides whether the next nonwhitespace character is a
  5300. % {. If so it reads up to the closing }, if not, it reads the whole
  5301. % line. Whatever was read is then fed to the next control sequence
  5302. % as an argument (by \parsebrace or \parsearg)
  5303. \def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx}
  5304. \def\braceorlinexxx{%
  5305. \ifx\nchar\bgroup\else
  5306. \expandafter\parsearg
  5307. \fi \next}
  5308. % We mant to disable all macros during \shipout so that they are not
  5309. % expanded by \write.
  5310. \def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}%
  5311. \edef\next{\macrolist}\expandafter\endgroup\next}
  5312. % @alias.
  5313. % We need some trickery to remove the optional spaces around the equal
  5314. % sign. Just make them active and then expand them all to nothing.
  5315. \def\alias{\begingroup\obeyspaces\parsearg\aliasxxx}
  5316. \def\aliasxxx #1{\aliasyyy#1\relax}
  5317. \def\aliasyyy #1=#2\relax{\ignoreactivespaces
  5318. \edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=%
  5319. \expandafter\noexpand\csname#2\endcsname}%
  5320. \expandafter\endgroup\next}
  5321. \message{cross references,}
  5322. % @xref etc.
  5323. \newwrite\auxfile
  5324. \newif\ifhavexrefs % True if xref values are known.
  5325. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  5326. % @inforef is relatively simple.
  5327. \def\inforef #1{\inforefzzz #1,,,,**}
  5328. \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  5329. node \samp{\ignorespaces#1{}}}
  5330. % @node's job is to define \lastnode.
  5331. \def\node{\ENVcheck\parsearg\nodezzz}
  5332. \def\nodezzz#1{\nodexxx #1,\finishnodeparse}
  5333. \def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  5334. \let\nwnode=\node
  5335. \let\lastnode=\relax
  5336. % The sectioning commands (@chapter, etc.) call these.
  5337. \def\donoderef{%
  5338. \ifx\lastnode\relax\else
  5339. \expandafter\expandafter\expandafter\setref{\lastnode}%
  5340. {Ysectionnumberandtype}%
  5341. \global\let\lastnode=\relax
  5342. \fi
  5343. }
  5344. \def\unnumbnoderef{%
  5345. \ifx\lastnode\relax\else
  5346. \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}%
  5347. \global\let\lastnode=\relax
  5348. \fi
  5349. }
  5350. \def\appendixnoderef{%
  5351. \ifx\lastnode\relax\else
  5352. \expandafter\expandafter\expandafter\setref{\lastnode}%
  5353. {Yappendixletterandtype}%
  5354. \global\let\lastnode=\relax
  5355. \fi
  5356. }
  5357. % @anchor{NAME} -- define xref target at arbitrary point.
  5358. %
  5359. \newcount\savesfregister
  5360. \gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  5361. \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  5362. \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  5363. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  5364. % anchor), namely NAME-title (the corresponding @chapter/etc. name),
  5365. % NAME-pg (the page number), and NAME-snt (section number and type).
  5366. % Called from \foonoderef.
  5367. %
  5368. % We have to set \indexdummies so commands such as @code in a section
  5369. % title aren't expanded. It would be nicer not to expand the titles in
  5370. % the first place, but there's so many layers that that is hard to do.
  5371. %
  5372. % Likewise, use \turnoffactive so that punctuation chars such as underscore
  5373. % and backslash work in node names.
  5374. %
  5375. \def\setref#1#2{{%
  5376. \atdummies
  5377. \pdfmkdest{#1}%
  5378. %
  5379. \turnoffactive
  5380. \dosetq{#1-title}{Ytitle}%
  5381. \dosetq{#1-pg}{Ypagenumber}%
  5382. \dosetq{#1-snt}{#2}%
  5383. }}
  5384. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  5385. % the node name, #2 the name of the Info cross-reference, #3 the printed
  5386. % node name, #4 the name of the Info file, #5 the name of the printed
  5387. % manual. All but the node name can be omitted.
  5388. %
  5389. \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  5390. \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  5391. \def\ref#1{\xrefX[#1,,,,,,,]}
  5392. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  5393. \unsepspaces
  5394. \def\printedmanual{\ignorespaces #5}%
  5395. \def\printednodename{\ignorespaces #3}%
  5396. \setbox1=\hbox{\printedmanual}%
  5397. \setbox0=\hbox{\printednodename}%
  5398. \ifdim \wd0 = 0pt
  5399. % No printed node name was explicitly given.
  5400. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
  5401. % Use the node name inside the square brackets.
  5402. \def\printednodename{\ignorespaces #1}%
  5403. \else
  5404. % Use the actual chapter/section title appear inside
  5405. % the square brackets. Use the real section title if we have it.
  5406. \ifdim \wd1 > 0pt
  5407. % It is in another manual, so we don't have it.
  5408. \def\printednodename{\ignorespaces #1}%
  5409. \else
  5410. \ifhavexrefs
  5411. % We know the real title if we have the xref values.
  5412. \def\printednodename{\refx{#1-title}{}}%
  5413. \else
  5414. % Otherwise just copy the Info node name.
  5415. \def\printednodename{\ignorespaces #1}%
  5416. \fi%
  5417. \fi
  5418. \fi
  5419. \fi
  5420. %
  5421. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  5422. % insert empty discretionaries after hyphens, which means that it will
  5423. % not find a line break at a hyphen in a node names. Since some manuals
  5424. % are best written with fairly long node names, containing hyphens, this
  5425. % is a loss. Therefore, we give the text of the node name again, so it
  5426. % is as if TeX is seeing it for the first time.
  5427. \ifpdf
  5428. \leavevmode
  5429. \getfilename{#4}%
  5430. {\turnoffactive \otherbackslash
  5431. \ifnum\filenamelength>0
  5432. \startlink attr{/Border [0 0 0]}%
  5433. goto file{\the\filename.pdf} name{#1}%
  5434. \else
  5435. \startlink attr{/Border [0 0 0]}%
  5436. goto name{#1}%
  5437. \fi
  5438. }%
  5439. \linkcolor
  5440. \fi
  5441. %
  5442. \ifdim \wd1 > 0pt
  5443. \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}%
  5444. \else
  5445. % _ (for example) has to be the character _ for the purposes of the
  5446. % control sequence corresponding to the node, but it has to expand
  5447. % into the usual \leavevmode...\vrule stuff for purposes of
  5448. % printing. So we \turnoffactive for the \refx-snt, back on for the
  5449. % printing, back off for the \refx-pg.
  5450. {\turnoffactive \otherbackslash
  5451. % Only output a following space if the -snt ref is nonempty; for
  5452. % @unnumbered and @anchor, it won't be.
  5453. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  5454. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  5455. }%
  5456. % output the `[mynode]' via a macro.
  5457. \xrefprintnodename\printednodename
  5458. %
  5459. % But we always want a comma and a space:
  5460. ,\space
  5461. %
  5462. % output the `page 3'.
  5463. \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}%
  5464. \fi
  5465. \endlink
  5466. \endgroup}
  5467. % This macro is called from \xrefX for the `[nodename]' part of xref
  5468. % output. It's a separate macro only so it can be changed more easily,
  5469. % since not square brackets don't work in some documents. Particularly
  5470. % one that Bob is working on :).
  5471. %
  5472. \def\xrefprintnodename#1{[#1]}
  5473. % \dosetq is called from \setref to do the actual \write (\iflinks).
  5474. %
  5475. \def\dosetq#1#2{%
  5476. {\let\folio=0%
  5477. \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}%
  5478. \iflinks \next \fi
  5479. }%
  5480. }
  5481. % \internalsetq{foo}{page} expands into
  5482. % CHARACTERS @xrdef{foo}{...expansion of \page...}
  5483. \def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}}
  5484. % Things to be expanded by \internalsetq.
  5485. %
  5486. \def\Ypagenumber{\folio}
  5487. \def\Ytitle{\thissection}
  5488. \def\Ynothing{}
  5489. \def\Ysectionnumberandtype{%
  5490. \ifnum\secno=0
  5491. \putwordChapter@tie \the\chapno
  5492. \else \ifnum\subsecno=0
  5493. \putwordSection@tie \the\chapno.\the\secno
  5494. \else \ifnum\subsubsecno=0
  5495. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  5496. \else
  5497. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  5498. \fi\fi\fi
  5499. }
  5500. \def\Yappendixletterandtype{%
  5501. \ifnum\secno=0
  5502. \putwordAppendix@tie @char\the\appendixno{}%
  5503. \else \ifnum\subsecno=0
  5504. \putwordSection@tie @char\the\appendixno.\the\secno
  5505. \else \ifnum\subsubsecno=0
  5506. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  5507. \else
  5508. \putwordSection@tie
  5509. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  5510. \fi\fi\fi
  5511. }
  5512. % Use TeX 3.0's \inputlineno to get the line number, for better error
  5513. % messages, but if we're using an old version of TeX, don't do anything.
  5514. %
  5515. \ifx\inputlineno\thisisundefined
  5516. \let\linenumber = \empty % Pre-3.0.
  5517. \else
  5518. \def\linenumber{\the\inputlineno:\space}
  5519. \fi
  5520. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  5521. % If its value is nonempty, SUFFIX is output afterward.
  5522. %
  5523. \def\refx#1#2{%
  5524. {%
  5525. \indexnofonts
  5526. \otherbackslash
  5527. \expandafter\global\expandafter\let\expandafter\thisrefX
  5528. \csname X#1\endcsname
  5529. }%
  5530. \ifx\thisrefX\relax
  5531. % If not defined, say something at least.
  5532. \angleleft un\-de\-fined\angleright
  5533. \iflinks
  5534. \ifhavexrefs
  5535. \message{\linenumber Undefined cross reference `#1'.}%
  5536. \else
  5537. \ifwarnedxrefs\else
  5538. \global\warnedxrefstrue
  5539. \message{Cross reference values unknown; you must run TeX again.}%
  5540. \fi
  5541. \fi
  5542. \fi
  5543. \else
  5544. % It's defined, so just use it.
  5545. \thisrefX
  5546. \fi
  5547. #2% Output the suffix in any case.
  5548. }
  5549. % This is the macro invoked by entries in the aux file.
  5550. %
  5551. \def\xrdef#1{\expandafter\gdef\csname X#1\endcsname}
  5552. % Read the last existing aux file, if any. No error if none exists.
  5553. \def\readauxfile{\begingroup
  5554. \catcode`\^^@=\other
  5555. \catcode`\^^A=\other
  5556. \catcode`\^^B=\other
  5557. \catcode`\^^C=\other
  5558. \catcode`\^^D=\other
  5559. \catcode`\^^E=\other
  5560. \catcode`\^^F=\other
  5561. \catcode`\^^G=\other
  5562. \catcode`\^^H=\other
  5563. \catcode`\^^K=\other
  5564. \catcode`\^^L=\other
  5565. \catcode`\^^N=\other
  5566. \catcode`\^^P=\other
  5567. \catcode`\^^Q=\other
  5568. \catcode`\^^R=\other
  5569. \catcode`\^^S=\other
  5570. \catcode`\^^T=\other
  5571. \catcode`\^^U=\other
  5572. \catcode`\^^V=\other
  5573. \catcode`\^^W=\other
  5574. \catcode`\^^X=\other
  5575. \catcode`\^^Z=\other
  5576. \catcode`\^^[=\other
  5577. \catcode`\^^\=\other
  5578. \catcode`\^^]=\other
  5579. \catcode`\^^^=\other
  5580. \catcode`\^^_=\other
  5581. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  5582. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  5583. % supported in the main text, it doesn't seem desirable. Furthermore,
  5584. % that is not enough: for node names that actually contain a ^
  5585. % character, we would end up writing a line like this: 'xrdef {'hat
  5586. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  5587. % argument, and \hat is not an expandable control sequence. It could
  5588. % all be worked out, but why? Either we support ^^ or we don't.
  5589. %
  5590. % The other change necessary for this was to define \auxhat:
  5591. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  5592. % and then to call \auxhat in \setq.
  5593. %
  5594. \catcode`\^=\other
  5595. %
  5596. % Special characters. Should be turned off anyway, but...
  5597. \catcode`\~=\other
  5598. \catcode`\[=\other
  5599. \catcode`\]=\other
  5600. \catcode`\"=\other
  5601. \catcode`\_=\other
  5602. \catcode`\|=\other
  5603. \catcode`\<=\other
  5604. \catcode`\>=\other
  5605. \catcode`\$=\other
  5606. \catcode`\#=\other
  5607. \catcode`\&=\other
  5608. \catcode`\%=\other
  5609. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  5610. %
  5611. % Make the characters 128-255 be printing characters
  5612. {%
  5613. \count 1=128
  5614. \def\loop{%
  5615. \catcode\count 1=\other
  5616. \advance\count 1 by 1
  5617. \ifnum \count 1<256 \loop \fi
  5618. }%
  5619. }%
  5620. %
  5621. % Turn off \ as an escape so we do not lose on
  5622. % entries which were dumped with control sequences in their names.
  5623. % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^
  5624. % Reference to such entries still does not work the way one would wish,
  5625. % but at least they do not bomb out when the aux file is read in.
  5626. \catcode`\\=\other
  5627. %
  5628. % @ is our escape character in .aux files.
  5629. \catcode`\{=1
  5630. \catcode`\}=2
  5631. \catcode`\@=0
  5632. %
  5633. \openin 1 \jobname.aux
  5634. \ifeof 1 \else
  5635. \closein 1
  5636. \input \jobname.aux
  5637. \global\havexrefstrue
  5638. \global\warnedobstrue
  5639. \fi
  5640. % Open the new aux file. TeX will close it automatically at exit.
  5641. \openout\auxfile=\jobname.aux
  5642. \endgroup}
  5643. % Footnotes.
  5644. \newcount \footnoteno
  5645. % The trailing space in the following definition for supereject is
  5646. % vital for proper filling; pages come out unaligned when you do a
  5647. % pagealignmacro call if that space before the closing brace is
  5648. % removed. (Generally, numeric constants should always be followed by a
  5649. % space to prevent strange expansion errors.)
  5650. \def\supereject{\par\penalty -20000\footnoteno =0 }
  5651. % @footnotestyle is meaningful for info output only.
  5652. \let\footnotestyle=\comment
  5653. \let\ptexfootnote=\footnote
  5654. {\catcode `\@=11
  5655. %
  5656. % Auto-number footnotes. Otherwise like plain.
  5657. \gdef\footnote{%
  5658. \let\indent=\ptexindent
  5659. \global\advance\footnoteno by \@ne
  5660. \edef\thisfootno{$^{\the\footnoteno}$}%
  5661. %
  5662. % In case the footnote comes at the end of a sentence, preserve the
  5663. % extra spacing after we do the footnote number.
  5664. \let\@sf\empty
  5665. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  5666. %
  5667. % Remove inadvertent blank space before typesetting the footnote number.
  5668. \unskip
  5669. \thisfootno\@sf
  5670. \dofootnote
  5671. }%
  5672. % Don't bother with the trickery in plain.tex to not require the
  5673. % footnote text as a parameter. Our footnotes don't need to be so general.
  5674. %
  5675. % Oh yes, they do; otherwise, @ifset and anything else that uses
  5676. % \parseargline fail inside footnotes because the tokens are fixed when
  5677. % the footnote is read. --karl, 16nov96.
  5678. %
  5679. % The start of the footnote looks usually like this:
  5680. \gdef\startfootins{\insert\footins\bgroup}
  5681. %
  5682. % ... but this macro is redefined inside @multitable.
  5683. %
  5684. \gdef\dofootnote{%
  5685. \startfootins
  5686. % We want to typeset this text as a normal paragraph, even if the
  5687. % footnote reference occurs in (for example) a display environment.
  5688. % So reset some parameters.
  5689. \hsize=\pagewidth
  5690. \interlinepenalty\interfootnotelinepenalty
  5691. \splittopskip\ht\strutbox % top baseline for broken footnotes
  5692. \splitmaxdepth\dp\strutbox
  5693. \floatingpenalty\@MM
  5694. \leftskip\z@skip
  5695. \rightskip\z@skip
  5696. \spaceskip\z@skip
  5697. \xspaceskip\z@skip
  5698. \parindent\defaultparindent
  5699. %
  5700. \smallfonts \rm
  5701. %
  5702. % Because we use hanging indentation in footnotes, a @noindent appears
  5703. % to exdent this text, so make it be a no-op. makeinfo does not use
  5704. % hanging indentation so @noindent can still be needed within footnote
  5705. % text after an @example or the like (not that this is good style).
  5706. \let\noindent = \relax
  5707. %
  5708. % Hang the footnote text off the number. Use \everypar in case the
  5709. % footnote extends for more than one paragraph.
  5710. \everypar = {\hang}%
  5711. \textindent{\thisfootno}%
  5712. %
  5713. % Don't crash into the line above the footnote text. Since this
  5714. % expands into a box, it must come within the paragraph, lest it
  5715. % provide a place where TeX can split the footnote.
  5716. \footstrut
  5717. \futurelet\next\fo@t
  5718. }
  5719. }%end \catcode `\@=11
  5720. % @| inserts a changebar to the left of the current line. It should
  5721. % surround any changed text. This approach does *not* work if the
  5722. % change spans more than two lines of output. To handle that, we would
  5723. % have adopt a much more difficult approach (putting marks into the main
  5724. % vertical list for the beginning and end of each change).
  5725. %
  5726. \def\|{%
  5727. % \vadjust can only be used in horizontal mode.
  5728. \leavevmode
  5729. %
  5730. % Append this vertical mode material after the current line in the output.
  5731. \vadjust{%
  5732. % We want to insert a rule with the height and depth of the current
  5733. % leading; that is exactly what \strutbox is supposed to record.
  5734. \vskip-\baselineskip
  5735. %
  5736. % \vadjust-items are inserted at the left edge of the type. So
  5737. % the \llap here moves out into the left-hand margin.
  5738. \llap{%
  5739. %
  5740. % For a thicker or thinner bar, change the `1pt'.
  5741. \vrule height\baselineskip width1pt
  5742. %
  5743. % This is the space between the bar and the text.
  5744. \hskip 12pt
  5745. }%
  5746. }%
  5747. }
  5748. % For a final copy, take out the rectangles
  5749. % that mark overfull boxes (in case you have decided
  5750. % that the text looks ok even though it passes the margin).
  5751. %
  5752. \def\finalout{\overfullrule=0pt}
  5753. % @image. We use the macros from epsf.tex to support this.
  5754. % If epsf.tex is not installed and @image is used, we complain.
  5755. %
  5756. % Check for and read epsf.tex up front. If we read it only at @image
  5757. % time, we might be inside a group, and then its definitions would get
  5758. % undone and the next image would fail.
  5759. \openin 1 = epsf.tex
  5760. \ifeof 1 \else
  5761. \closein 1
  5762. % Do not bother showing banner with epsf.tex v2.7k (available in
  5763. % doc/epsf.tex and on ctan).
  5764. \def\epsfannounce{\toks0 = }%
  5765. \input epsf.tex
  5766. \fi
  5767. %
  5768. % We will only complain once about lack of epsf.tex.
  5769. \newif\ifwarnednoepsf
  5770. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  5771. work. It is also included in the Texinfo distribution, or you can get
  5772. it from ftp://tug.org/tex/epsf.tex.}
  5773. %
  5774. \def\image#1{%
  5775. \ifx\epsfbox\undefined
  5776. \ifwarnednoepsf \else
  5777. \errhelp = \noepsfhelp
  5778. \errmessage{epsf.tex not found, images will be ignored}%
  5779. \global\warnednoepsftrue
  5780. \fi
  5781. \else
  5782. \imagexxx #1,,,,,\finish
  5783. \fi
  5784. }
  5785. %
  5786. % Arguments to @image:
  5787. % #1 is (mandatory) image filename; we tack on .eps extension.
  5788. % #2 is (optional) width, #3 is (optional) height.
  5789. % #4 is (ignored optional) html alt text.
  5790. % #5 is (ignored optional) extension.
  5791. % #6 is just the usual extra ignored arg for parsing this stuff.
  5792. \newif\ifimagevmode
  5793. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  5794. \catcode`\^^M = 5 % in case we're inside an example
  5795. \normalturnoffactive % allow _ et al. in names
  5796. % If the image is by itself, center it.
  5797. \ifvmode
  5798. \imagevmodetrue
  5799. \nobreak\bigskip
  5800. % Usually we'll have text after the image which will insert
  5801. % \parskip glue, so insert it here too to equalize the space
  5802. % above and below.
  5803. \nobreak\vskip\parskip
  5804. \nobreak
  5805. \line\bgroup\hss
  5806. \fi
  5807. %
  5808. % Output the image.
  5809. \ifpdf
  5810. \dopdfimage{#1}{#2}{#3}%
  5811. \else
  5812. % \epsfbox itself resets \epsf?size at each figure.
  5813. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  5814. \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  5815. \epsfbox{#1.eps}%
  5816. \fi
  5817. %
  5818. \ifimagevmode \hss \egroup \bigbreak \fi % space after the image
  5819. \endgroup}
  5820. \message{localization,}
  5821. % and i18n.
  5822. % @documentlanguage is usually given very early, just after
  5823. % @setfilename. If done too late, it may not override everything
  5824. % properly. Single argument is the language abbreviation.
  5825. % It would be nice if we could set up a hyphenation file here.
  5826. %
  5827. \def\documentlanguage{\parsearg\dodocumentlanguage}
  5828. \def\dodocumentlanguage#1{%
  5829. \tex % read txi-??.tex file in plain TeX.
  5830. % Read the file if it exists.
  5831. \openin 1 txi-#1.tex
  5832. \ifeof1
  5833. \errhelp = \nolanghelp
  5834. \errmessage{Cannot read language file txi-#1.tex}%
  5835. \let\temp = \relax
  5836. \else
  5837. \def\temp{\input txi-#1.tex }%
  5838. \fi
  5839. \temp
  5840. \endgroup
  5841. }
  5842. \newhelp\nolanghelp{The given language definition file cannot be found or
  5843. is empty. Maybe you need to install it? In the current directory
  5844. should work if nowhere else does.}
  5845. % @documentencoding should change something in TeX eventually, most
  5846. % likely, but for now just recognize it.
  5847. \let\documentencoding = \comment
  5848. % Page size parameters.
  5849. %
  5850. \newdimen\defaultparindent \defaultparindent = 15pt
  5851. \chapheadingskip = 15pt plus 4pt minus 2pt
  5852. \secheadingskip = 12pt plus 3pt minus 2pt
  5853. \subsecheadingskip = 9pt plus 2pt minus 2pt
  5854. % Prevent underfull vbox error messages.
  5855. \vbadness = 10000
  5856. % Don't be so finicky about underfull hboxes, either.
  5857. \hbadness = 2000
  5858. % Following George Bush, just get rid of widows and orphans.
  5859. \widowpenalty=10000
  5860. \clubpenalty=10000
  5861. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  5862. % using an old version of TeX, don't do anything. We want the amount of
  5863. % stretch added to depend on the line length, hence the dependence on
  5864. % \hsize. We call this whenever the paper size is set.
  5865. %
  5866. \def\setemergencystretch{%
  5867. \ifx\emergencystretch\thisisundefined
  5868. % Allow us to assign to \emergencystretch anyway.
  5869. \def\emergencystretch{\dimen0}%
  5870. \else
  5871. \emergencystretch = .15\hsize
  5872. \fi
  5873. }
  5874. % Parameters in order: 1) textheight; 2) textwidth; 3) voffset;
  5875. % 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8)
  5876. % physical page width.
  5877. %
  5878. % We also call \setleading{\textleading}, so the caller should define
  5879. % \textleading. The caller should also set \parskip.
  5880. %
  5881. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  5882. \voffset = #3\relax
  5883. \topskip = #6\relax
  5884. \splittopskip = \topskip
  5885. %
  5886. \vsize = #1\relax
  5887. \advance\vsize by \topskip
  5888. \outervsize = \vsize
  5889. \advance\outervsize by 2\topandbottommargin
  5890. \pageheight = \vsize
  5891. %
  5892. \hsize = #2\relax
  5893. \outerhsize = \hsize
  5894. \advance\outerhsize by 0.5in
  5895. \pagewidth = \hsize
  5896. %
  5897. \normaloffset = #4\relax
  5898. \bindingoffset = #5\relax
  5899. %
  5900. \ifpdf
  5901. \pdfpageheight #7\relax
  5902. \pdfpagewidth #8\relax
  5903. \fi
  5904. %
  5905. \setleading{\textleading}
  5906. %
  5907. \parindent = \defaultparindent
  5908. \setemergencystretch
  5909. }
  5910. % @letterpaper (the default).
  5911. \def\letterpaper{{\globaldefs = 1
  5912. \parskip = 3pt plus 2pt minus 1pt
  5913. \textleading = 13.2pt
  5914. %
  5915. % If page is nothing but text, make it come out even.
  5916. \internalpagesizes{46\baselineskip}{6in}%
  5917. {\voffset}{.25in}%
  5918. {\bindingoffset}{36pt}%
  5919. {11in}{8.5in}%
  5920. }}
  5921. % Use @smallbook to reset parameters for 7x9.5 (or so) format.
  5922. \def\smallbook{{\globaldefs = 1
  5923. \parskip = 2pt plus 1pt
  5924. \textleading = 12pt
  5925. %
  5926. \internalpagesizes{7.5in}{5in}%
  5927. {\voffset}{.25in}%
  5928. {\bindingoffset}{16pt}%
  5929. {9.25in}{7in}%
  5930. %
  5931. \lispnarrowing = 0.3in
  5932. \tolerance = 700
  5933. \hfuzz = 1pt
  5934. \contentsrightmargin = 0pt
  5935. \defbodyindent = .5cm
  5936. }}
  5937. % Use @afourpaper to print on European A4 paper.
  5938. \def\afourpaper{{\globaldefs = 1
  5939. \parskip = 3pt plus 2pt minus 1pt
  5940. \textleading = 13.2pt
  5941. %
  5942. % Double-side printing via postscript on Laserjet 4050
  5943. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  5944. % To change the settings for a different printer or situation, adjust
  5945. % \normaloffset until the front-side and back-side texts align. Then
  5946. % do the same for \bindingoffset. You can set these for testing in
  5947. % your texinfo source file like this:
  5948. % @tex
  5949. % \global\normaloffset = -6mm
  5950. % \global\bindingoffset = 10mm
  5951. % @end tex
  5952. \internalpagesizes{51\baselineskip}{160mm}
  5953. {\voffset}{\hoffset}%
  5954. {\bindingoffset}{44pt}%
  5955. {297mm}{210mm}%
  5956. %
  5957. \tolerance = 700
  5958. \hfuzz = 1pt
  5959. \contentsrightmargin = 0pt
  5960. \defbodyindent = 5mm
  5961. }}
  5962. % Use @afivepaper to print on European A5 paper.
  5963. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  5964. % He also recommends making @example and @lisp be small.
  5965. \def\afivepaper{{\globaldefs = 1
  5966. \parskip = 2pt plus 1pt minus 0.1pt
  5967. \textleading = 12.5pt
  5968. %
  5969. \internalpagesizes{160mm}{120mm}%
  5970. {\voffset}{\hoffset}%
  5971. {\bindingoffset}{8pt}%
  5972. {210mm}{148mm}%
  5973. %
  5974. \lispnarrowing = 0.2in
  5975. \tolerance = 800
  5976. \hfuzz = 1.2pt
  5977. \contentsrightmargin = 0pt
  5978. \defbodyindent = 2mm
  5979. \tableindent = 12mm
  5980. }}
  5981. % A specific text layout, 24x15cm overall, intended for A4 paper.
  5982. \def\afourlatex{{\globaldefs = 1
  5983. \afourpaper
  5984. \internalpagesizes{237mm}{150mm}%
  5985. {\voffset}{4.6mm}%
  5986. {\bindingoffset}{7mm}%
  5987. {297mm}{210mm}%
  5988. %
  5989. % Must explicitly reset to 0 because we call \afourpaper.
  5990. \globaldefs = 0
  5991. }}
  5992. % Use @afourwide to print on A4 paper in landscape format.
  5993. \def\afourwide{{\globaldefs = 1
  5994. \afourpaper
  5995. \internalpagesizes{241mm}{165mm}%
  5996. {\voffset}{-2.95mm}%
  5997. {\bindingoffset}{7mm}%
  5998. {297mm}{210mm}%
  5999. \globaldefs = 0
  6000. }}
  6001. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  6002. % Perhaps we should allow setting the margins, \topskip, \parskip,
  6003. % and/or leading, also. Or perhaps we should compute them somehow.
  6004. %
  6005. \def\pagesizes{\parsearg\pagesizesxxx}
  6006. \def\pagesizesxxx#1{\pagesizesyyy #1,,\finish}
  6007. \def\pagesizesyyy#1,#2,#3\finish{{%
  6008. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  6009. \globaldefs = 1
  6010. %
  6011. \parskip = 3pt plus 2pt minus 1pt
  6012. \setleading{\textleading}%
  6013. %
  6014. \dimen0 = #1
  6015. \advance\dimen0 by \voffset
  6016. %
  6017. \dimen2 = \hsize
  6018. \advance\dimen2 by \normaloffset
  6019. %
  6020. \internalpagesizes{#1}{\hsize}%
  6021. {\voffset}{\normaloffset}%
  6022. {\bindingoffset}{44pt}%
  6023. {\dimen0}{\dimen2}%
  6024. }}
  6025. % Set default to letter.
  6026. %
  6027. \letterpaper
  6028. \message{and turning on texinfo input format.}
  6029. % Define macros to output various characters with catcode for normal text.
  6030. \catcode`\"=\other
  6031. \catcode`\~=\other
  6032. \catcode`\^=\other
  6033. \catcode`\_=\other
  6034. \catcode`\|=\other
  6035. \catcode`\<=\other
  6036. \catcode`\>=\other
  6037. \catcode`\+=\other
  6038. \catcode`\$=\other
  6039. \def\normaldoublequote{"}
  6040. \def\normaltilde{~}
  6041. \def\normalcaret{^}
  6042. \def\normalunderscore{_}
  6043. \def\normalverticalbar{|}
  6044. \def\normalless{<}
  6045. \def\normalgreater{>}
  6046. \def\normalplus{+}
  6047. \def\normaldollar{$}%$ font-lock fix
  6048. % This macro is used to make a character print one way in ttfont
  6049. % where it can probably just be output, and another way in other fonts,
  6050. % where something hairier probably needs to be done.
  6051. %
  6052. % #1 is what to print if we are indeed using \tt; #2 is what to print
  6053. % otherwise. Since all the Computer Modern typewriter fonts have zero
  6054. % interword stretch (and shrink), and it is reasonable to expect all
  6055. % typewriter fonts to have this, we can check that font parameter.
  6056. %
  6057. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  6058. % Same as above, but check for italic font. Actually this also catches
  6059. % non-italic slanted fonts since it is impossible to distinguish them from
  6060. % italic fonts. But since this is only used by $ and it uses \sl anyway
  6061. % this is not a problem.
  6062. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  6063. % Turn off all special characters except @
  6064. % (and those which the user can use as if they were ordinary).
  6065. % Most of these we simply print from the \tt font, but for some, we can
  6066. % use math or other variants that look better in normal text.
  6067. \catcode`\"=\active
  6068. \def\activedoublequote{{\tt\char34}}
  6069. \let"=\activedoublequote
  6070. \catcode`\~=\active
  6071. \def~{{\tt\char126}}
  6072. \chardef\hat=`\^
  6073. \catcode`\^=\active
  6074. \def^{{\tt \hat}}
  6075. \catcode`\_=\active
  6076. \def_{\ifusingtt\normalunderscore\_}
  6077. % Subroutine for the previous macro.
  6078. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  6079. \catcode`\|=\active
  6080. \def|{{\tt\char124}}
  6081. \chardef \less=`\<
  6082. \catcode`\<=\active
  6083. \def<{{\tt \less}}
  6084. \chardef \gtr=`\>
  6085. \catcode`\>=\active
  6086. \def>{{\tt \gtr}}
  6087. \catcode`\+=\active
  6088. \def+{{\tt \char 43}}
  6089. \catcode`\$=\active
  6090. \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  6091. % Set up an active definition for =, but don't enable it most of the time.
  6092. {\catcode`\==\active
  6093. \global\def={{\tt \char 61}}}
  6094. \catcode`+=\active
  6095. \catcode`\_=\active
  6096. % If a .fmt file is being used, characters that might appear in a file
  6097. % name cannot be active until we have parsed the command line.
  6098. % So turn them off again, and have \everyjob (or @setfilename) turn them on.
  6099. % \otherifyactive is called near the end of this file.
  6100. \def\otherifyactive{\catcode`+=\other \catcode`\_=\other}
  6101. \catcode`\@=0
  6102. % \rawbackslashxx outputs one backslash character in current font,
  6103. % as in \char`\\.
  6104. \global\chardef\rawbackslashxx=`\\
  6105. % \rawbackslash defines an active \ to do \rawbackslashxx.
  6106. % \otherbackslash defines an active \ to be a literal `\' character with
  6107. % catcode other.
  6108. {\catcode`\\=\active
  6109. @gdef@rawbackslash{@let\=@rawbackslashxx}
  6110. @gdef@otherbackslash{@let\=@realbackslash}
  6111. }
  6112. % \realbackslash is an actual character `\' with catcode other.
  6113. {\catcode`\\=\other @gdef@realbackslash{\}}
  6114. % \normalbackslash outputs one backslash in fixed width font.
  6115. \def\normalbackslash{{\tt\rawbackslashxx}}
  6116. \catcode`\\=\active
  6117. % Used sometimes to turn off (effectively) the active characters
  6118. % even after parsing them.
  6119. @def@turnoffactive{%
  6120. @let"=@normaldoublequote
  6121. @let\=@realbackslash
  6122. @let~=@normaltilde
  6123. @let^=@normalcaret
  6124. @let_=@normalunderscore
  6125. @let|=@normalverticalbar
  6126. @let<=@normalless
  6127. @let>=@normalgreater
  6128. @let+=@normalplus
  6129. @let$=@normaldollar %$ font-lock fix
  6130. }
  6131. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  6132. % the literal character `\'. (Thus, \ is not expandable when this is in
  6133. % effect.)
  6134. %
  6135. @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash}
  6136. % Make _ and + \other characters, temporarily.
  6137. % This is canceled by @fixbackslash.
  6138. @otherifyactive
  6139. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  6140. % That is what \eatinput is for; after that, the `\' should revert to printing
  6141. % a backslash.
  6142. %
  6143. @gdef@eatinput input texinfo{@fixbackslash}
  6144. @global@let\ = @eatinput
  6145. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  6146. % the first `\{ in the file would cause an error. This macro tries to fix
  6147. % that, assuming it is called before the first `\' could plausibly occur.
  6148. % Also back turn on active characters that might appear in the input
  6149. % file name, in case not using a pre-dumped format.
  6150. %
  6151. @gdef@fixbackslash{%
  6152. @ifx\@eatinput @let\ = @normalbackslash @fi
  6153. @catcode`+=@active
  6154. @catcode`@_=@active
  6155. }
  6156. % Say @foo, not \foo, in error messages.
  6157. @escapechar = `@@
  6158. % These look ok in all fonts, so just make them not special.
  6159. @catcode`@& = @other
  6160. @catcode`@# = @other
  6161. @catcode`@% = @other
  6162. @c Set initial fonts.
  6163. @textfonts
  6164. @rm
  6165. @c Local variables:
  6166. @c eval: (add-hook 'write-file-hooks 'time-stamp)
  6167. @c page-delimiter: "^\\\\message"
  6168. @c time-stamp-start: "def\\\\texinfoversion{"
  6169. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  6170. @c time-stamp-end: "}"
  6171. @c End: