txipsfonts-bronger.tex 208 KB

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