texinfo.tex 288 KB

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