texinfo.tex 371 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672
  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{2018-12-28.17}
  7. %
  8. % Copyright 1985, 1986, 1988, 1990-2018 Free Software Foundation, Inc.
  9. %
  10. % This texinfo.tex file is free software: you can redistribute it and/or
  11. % modify it under the terms of the GNU General Public License as
  12. % published by the Free Software Foundation, either version 3 of the
  13. % License, or (at your option) any later version.
  14. %
  15. % This texinfo.tex file is distributed in the hope that it will be
  16. % useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  17. % of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. % General Public License for more details.
  19. %
  20. % You should have received a copy of the GNU General Public License
  21. % along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. %
  23. % As a special exception, when this file is read by TeX when processing
  24. % a Texinfo source document, you may use the result without
  25. % restriction. This Exception is an additional permission under section 7
  26. % of the GNU General Public License, version 3 ("GPLv3").
  27. %
  28. % Please try the latest version of texinfo.tex before submitting bug
  29. % reports; you can get the latest version from:
  30. % https://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
  31. % https://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
  32. % https://www.gnu.org/software/texinfo/ (the Texinfo home page)
  33. % The texinfo.tex in any given distribution could well be out
  34. % of date, so if that's what you're using, please check.
  35. %
  36. % Send bug reports to bug-texinfo@gnu.org. Please include including a
  37. % complete document in each bug report with which we can reproduce the
  38. % problem. Patches are, of course, greatly appreciated.
  39. %
  40. % To process a Texinfo manual with TeX, it's most reliable to use the
  41. % texi2dvi shell script that comes with the distribution. For a simple
  42. % manual foo.texi, however, you can get away with this:
  43. % tex foo.texi
  44. % texindex foo.??
  45. % tex foo.texi
  46. % tex foo.texi
  47. % dvips foo.dvi -o # or whatever; this makes foo.ps.
  48. % The extra TeX runs get the cross-reference information correct.
  49. % Sometimes one run after texindex suffices, and sometimes you need more
  50. % than two; texi2dvi does it as many times as necessary.
  51. %
  52. % It is possible to adapt texinfo.tex for other languages, to some
  53. % extent. You can get the existing language-specific files from the
  54. % full Texinfo distribution.
  55. %
  56. % The GNU Texinfo home page is https://www.gnu.org/software/texinfo.
  57. \message{Loading texinfo [version \texinfoversion]:}
  58. % If in a .fmt file, print the version number
  59. % and turn on active characters that we couldn't do earlier because
  60. % they might have appeared in the input file name.
  61. \everyjob{\message{[Texinfo version \texinfoversion]}%
  62. \catcode`+=\active \catcode`\_=\active}
  63. % LaTeX's \typeout. This ensures that the messages it is used for
  64. % are identical in format to the corresponding ones from latex/pdflatex.
  65. \def\typeout{\immediate\write17}%
  66. \chardef\other=12
  67. % We never want plain's \outer definition of \+ in Texinfo.
  68. % For @tex, we can use \tabalign.
  69. \let\+ = \relax
  70. % Save some plain tex macros whose names we will redefine.
  71. \let\ptexb=\b
  72. \let\ptexbullet=\bullet
  73. \let\ptexc=\c
  74. \let\ptexcomma=\,
  75. \let\ptexdot=\.
  76. \let\ptexdots=\dots
  77. \let\ptexend=\end
  78. \let\ptexequiv=\equiv
  79. \let\ptexexclam=\!
  80. \let\ptexfootnote=\footnote
  81. \let\ptexgtr=>
  82. \let\ptexhat=^
  83. \let\ptexi=\i
  84. \let\ptexindent=\indent
  85. \let\ptexinsert=\insert
  86. \let\ptexlbrace=\{
  87. \let\ptexless=<
  88. \let\ptexnewwrite\newwrite
  89. \let\ptexnoindent=\noindent
  90. \let\ptexplus=+
  91. \let\ptexraggedright=\raggedright
  92. \let\ptexrbrace=\}
  93. \let\ptexslash=\/
  94. \let\ptexsp=\sp
  95. \let\ptexstar=\*
  96. \let\ptexsup=\sup
  97. \let\ptext=\t
  98. \let\ptextop=\top
  99. {\catcode`\'=\active \global\let\ptexquoteright'}% active in plain's math mode
  100. % If this character appears in an error message or help string, it
  101. % starts a new line in the output.
  102. \newlinechar = `^^J
  103. % Use TeX 3.0's \inputlineno to get the line number, for better error
  104. % messages, but if we're using an old version of TeX, don't do anything.
  105. %
  106. \ifx\inputlineno\thisisundefined
  107. \let\linenumber = \empty % Pre-3.0.
  108. \else
  109. \def\linenumber{l.\the\inputlineno:\space}
  110. \fi
  111. % Set up fixed words for English if not already set.
  112. \ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi
  113. \ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi
  114. \ifx\putworderror\undefined \gdef\putworderror{error}\fi
  115. \ifx\putwordfile\undefined \gdef\putwordfile{file}\fi
  116. \ifx\putwordin\undefined \gdef\putwordin{in}\fi
  117. \ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
  118. \ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi
  119. \ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi
  120. \ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi
  121. \ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi
  122. \ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi
  123. \ifx\putwordof\undefined \gdef\putwordof{of}\fi
  124. \ifx\putwordon\undefined \gdef\putwordon{on}\fi
  125. \ifx\putwordpage\undefined \gdef\putwordpage{page}\fi
  126. \ifx\putwordsection\undefined \gdef\putwordsection{section}\fi
  127. \ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi
  128. \ifx\putwordsee\undefined \gdef\putwordsee{see}\fi
  129. \ifx\putwordSee\undefined \gdef\putwordSee{See}\fi
  130. \ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi
  131. \ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi
  132. %
  133. \ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi
  134. \ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi
  135. \ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi
  136. \ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi
  137. \ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi
  138. \ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi
  139. \ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi
  140. \ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi
  141. \ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi
  142. \ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi
  143. \ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi
  144. \ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi
  145. %
  146. \ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi
  147. \ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi
  148. \ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi
  149. \ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
  150. \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
  151. % Give the space character the catcode for a space.
  152. \def\spaceisspace{\catcode`\ =10\relax}
  153. % Likewise for ^^M, the end of line character.
  154. \def\endlineisspace{\catcode13=10\relax}
  155. \chardef\dashChar = `\-
  156. \chardef\slashChar = `\/
  157. \chardef\underChar = `\_
  158. % Ignore a token.
  159. %
  160. \def\gobble#1{}
  161. % The following is used inside several \edef's.
  162. \def\makecsname#1{\expandafter\noexpand\csname#1\endcsname}
  163. % Hyphenation fixes.
  164. \hyphenation{
  165. Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script
  166. ap-pen-dix bit-map bit-maps
  167. data-base data-bases eshell fall-ing half-way long-est man-u-script
  168. man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm
  169. par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces
  170. spell-ing spell-ings
  171. stand-alone strong-est time-stamp time-stamps which-ever white-space
  172. wide-spread wrap-around
  173. }
  174. % Sometimes it is convenient to have everything in the transcript file
  175. % and nothing on the terminal. We don't just call \tracingall here,
  176. % since that produces some useless output on the terminal. We also make
  177. % some effort to order the tracing commands to reduce output in the log
  178. % file; cf. trace.sty in LaTeX.
  179. %
  180. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  181. \def\loggingall{%
  182. \tracingstats2
  183. \tracingpages1
  184. \tracinglostchars2 % 2 gives us more in etex
  185. \tracingparagraphs1
  186. \tracingoutput1
  187. \tracingmacros2
  188. \tracingrestores1
  189. \showboxbreadth\maxdimen \showboxdepth\maxdimen
  190. \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
  191. \tracingscantokens1
  192. \tracingifs1
  193. \tracinggroups1
  194. \tracingnesting2
  195. \tracingassigns1
  196. \fi
  197. \tracingcommands3 % 3 gives us more in etex
  198. \errorcontextlines16
  199. }%
  200. % @errormsg{MSG}. Do the index-like expansions on MSG, but if things
  201. % aren't perfect, it's not the end of the world, being an error message,
  202. % after all.
  203. %
  204. \def\errormsg{\begingroup \indexnofonts \doerrormsg}
  205. \def\doerrormsg#1{\errmessage{#1}}
  206. % add check for \lastpenalty to plain's definitions. If the last thing
  207. % we did was a \nobreak, we don't want to insert more space.
  208. %
  209. \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount
  210. \removelastskip\penalty-50\smallskip\fi\fi}
  211. \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount
  212. \removelastskip\penalty-100\medskip\fi\fi}
  213. \def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
  214. \removelastskip\penalty-200\bigskip\fi\fi}
  215. % Output routine
  216. %
  217. % For a final copy, take out the rectangles
  218. % that mark overfull boxes (in case you have decided
  219. % that the text looks ok even though it passes the margin).
  220. %
  221. \def\finalout{\overfullrule=0pt }
  222. \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
  223. \newdimen\topandbottommargin \topandbottommargin=.75in
  224. % Output a mark which sets \thischapter, \thissection and \thiscolor.
  225. % We dump everything together because we only have one kind of mark.
  226. % This works because we only use \botmark / \topmark, not \firstmark.
  227. %
  228. % A mark contains a subexpression of the \ifcase ... \fi construct.
  229. % \get*marks macros below extract the needed part using \ifcase.
  230. %
  231. % Another complication is to let the user choose whether \thischapter
  232. % (\thissection) refers to the chapter (section) in effect at the top
  233. % of a page, or that at the bottom of a page.
  234. % \domark is called twice inside \chapmacro, to add one
  235. % mark before the section break, and one after.
  236. % In the second call \prevchapterdefs is the same as \lastchapterdefs,
  237. % and \prevsectiondefs is the same as \lastsectiondefs.
  238. % Then if the page is not broken at the mark, some of the previous
  239. % section appears on the page, and we can get the name of this section
  240. % from \firstmark for @everyheadingmarks top.
  241. % @everyheadingmarks bottom uses \botmark.
  242. %
  243. % See page 260 of The TeXbook.
  244. \def\domark{%
  245. \toks0=\expandafter{\lastchapterdefs}%
  246. \toks2=\expandafter{\lastsectiondefs}%
  247. \toks4=\expandafter{\prevchapterdefs}%
  248. \toks6=\expandafter{\prevsectiondefs}%
  249. \toks8=\expandafter{\lastcolordefs}%
  250. \mark{%
  251. \the\toks0 \the\toks2 % 0: marks for @everyheadingmarks top
  252. \noexpand\or \the\toks4 \the\toks6 % 1: for @everyheadingmarks bottom
  253. \noexpand\else \the\toks8 % 2: color marks
  254. }%
  255. }
  256. % \gettopheadingmarks, \getbottomheadingmarks,
  257. % \getcolormarks - extract needed part of mark.
  258. %
  259. % \topmark doesn't work for the very first chapter (after the title
  260. % page or the contents), so we use \firstmark there -- this gets us
  261. % the mark with the chapter defs, unless the user sneaks in, e.g.,
  262. % @setcolor (or @url, or @link, etc.) between @contents and the very
  263. % first @chapter.
  264. \def\gettopheadingmarks{%
  265. \ifcase0\topmark\fi
  266. \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
  267. }
  268. \def\getbottomheadingmarks{\ifcase1\botmark\fi}
  269. \def\getcolormarks{\ifcase2\topmark\fi}
  270. % Avoid "undefined control sequence" errors.
  271. \def\lastchapterdefs{}
  272. \def\lastsectiondefs{}
  273. \def\lastsection{}
  274. \def\prevchapterdefs{}
  275. \def\prevsectiondefs{}
  276. \def\lastcolordefs{}
  277. % Margin to add to right of even pages, to left of odd pages.
  278. \newdimen\bindingoffset
  279. \newdimen\normaloffset
  280. \newdimen\txipagewidth \newdimen\txipageheight
  281. % Main output routine.
  282. %
  283. \chardef\PAGE = 255
  284. \output = {\onepageout{\pagecontents\PAGE}}
  285. \newbox\headlinebox
  286. \newbox\footlinebox
  287. % \onepageout takes a vbox as an argument.
  288. % \shipout a vbox for a single page, adding an optional header, footer
  289. % and footnote. This also causes index entries for this page to be written
  290. % to the auxiliary files.
  291. %
  292. \def\onepageout#1{%
  293. \hoffset=\normaloffset
  294. %
  295. \ifodd\pageno \advance\hoffset by \bindingoffset
  296. \else \advance\hoffset by -\bindingoffset\fi
  297. %
  298. % Common context changes for both heading and footing.
  299. % Do this outside of the \shipout so @code etc. will be expanded in
  300. % the headline as they should be, not taken literally (outputting ''code).
  301. \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
  302. %
  303. % Retrieve the information for the headings from the marks in the page,
  304. % and call Plain TeX's \makeheadline and \makefootline, which use the
  305. % values in \headline and \footline.
  306. %
  307. % This is used to check if we are on the first page of a chapter.
  308. \ifcase1\topmark\fi
  309. \let\prevchaptername\thischaptername
  310. \ifcase0\firstmark\fi
  311. \let\curchaptername\thischaptername
  312. %
  313. \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
  314. \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
  315. %
  316. \ifx\curchaptername\prevchaptername
  317. \let\thischapterheading\thischapter
  318. \else
  319. % \thischapterheading is the same as \thischapter except it is blank
  320. % for the first page of a chapter. This is to prevent the chapter name
  321. % being shown twice.
  322. \def\thischapterheading{}%
  323. \fi
  324. %
  325. \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
  326. \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
  327. %
  328. {%
  329. % Set context for writing to auxiliary files like index files.
  330. % Have to do this stuff outside the \shipout because we want it to
  331. % take effect in \write's, yet the group defined by the \vbox ends
  332. % before the \shipout runs.
  333. %
  334. \indexdummies % don't expand commands in the output.
  335. \normalturnoffactive % \ in index entries must not stay \, e.g., if
  336. % the page break happens to be in the middle of an example.
  337. % We don't want .vr (or whatever) entries like this:
  338. % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
  339. % "\acronym" won't work when it's read back in;
  340. % it needs to be
  341. % {\code {{\backslashcurfont }acronym}
  342. \shipout\vbox{%
  343. % Do this early so pdf references go to the beginning of the page.
  344. \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
  345. %
  346. \unvbox\headlinebox
  347. \pagebody{#1}%
  348. \ifdim\ht\footlinebox > 0pt
  349. % Only leave this space if the footline is nonempty.
  350. % (We lessened \vsize for it in \oddfootingyyy.)
  351. % The \baselineskip=24pt in plain's \makefootline has no effect.
  352. \vskip 24pt
  353. \unvbox\footlinebox
  354. \fi
  355. %
  356. }% end of \shipout\vbox
  357. }% end of group with \indexdummies
  358. \advancepageno
  359. \ifnum\outputpenalty>-20000 \else\dosupereject\fi
  360. }
  361. \newinsert\margin \dimen\margin=\maxdimen
  362. % Main part of page, including any footnotes
  363. \def\pagebody#1{\vbox to\txipageheight{\boxmaxdepth=\maxdepth #1}}
  364. {\catcode`\@ =11
  365. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  366. % marginal hacks, juha@viisa.uucp (Juha Takala)
  367. \ifvoid\margin\else % marginal info is present
  368. \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi
  369. \dimen@=\dp#1\relax \unvbox#1\relax
  370. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  371. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  372. }
  373. % Argument parsing
  374. % Parse an argument, then pass it to #1. The argument is the rest of
  375. % the input line (except we remove a trailing comment). #1 should be a
  376. % macro which expects an ordinary undelimited TeX argument.
  377. % For example, \def\foo{\parsearg\fooxxx}.
  378. %
  379. \def\parsearg{\parseargusing{}}
  380. \def\parseargusing#1#2{%
  381. \def\argtorun{#2}%
  382. \begingroup
  383. \obeylines
  384. \spaceisspace
  385. #1%
  386. \parseargline\empty% Insert the \empty token, see \finishparsearg below.
  387. }
  388. {\obeylines %
  389. \gdef\parseargline#1^^M{%
  390. \endgroup % End of the group started in \parsearg.
  391. \argremovecomment #1\comment\ArgTerm%
  392. }%
  393. }
  394. % First remove any @comment, then any @c comment. Also remove a @texinfoc
  395. % comment (see \scanmacro for details). Pass the result on to \argcheckspaces.
  396. \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
  397. \def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
  398. \def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
  399. % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
  400. %
  401. % \argremovec might leave us with trailing space, e.g.,
  402. % @end itemize @c foo
  403. % This space token undergoes the same procedure and is eventually removed
  404. % by \finishparsearg.
  405. %
  406. \def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M}
  407. \def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M}
  408. \def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{%
  409. \def\temp{#3}%
  410. \ifx\temp\empty
  411. % Do not use \next, perhaps the caller of \parsearg uses it; reuse \temp:
  412. \let\temp\finishparsearg
  413. \else
  414. \let\temp\argcheckspaces
  415. \fi
  416. % Put the space token in:
  417. \temp#1 #3\ArgTerm
  418. }
  419. % If a _delimited_ argument is enclosed in braces, they get stripped; so
  420. % to get _exactly_ the rest of the line, we had to prevent such situation.
  421. % We prepended an \empty token at the very beginning and we expand it now,
  422. % just before passing the control to \argtorun.
  423. % (Similarly, we have to think about #3 of \argcheckspacesY above: it is
  424. % either the null string, or it ends with \^^M---thus there is no danger
  425. % that a pair of braces would be stripped.
  426. %
  427. % But first, we have to remove the trailing space token.
  428. %
  429. \def\finishparsearg#1 \ArgTerm{\expandafter\argtorun\expandafter{#1}}
  430. % \parseargdef - define a command taking an argument on the line
  431. %
  432. % \parseargdef\foo{...}
  433. % is roughly equivalent to
  434. % \def\foo{\parsearg\Xfoo}
  435. % \def\Xfoo#1{...}
  436. \def\parseargdef#1{%
  437. \expandafter \doparseargdef \csname\string#1\endcsname #1%
  438. }
  439. \def\doparseargdef#1#2{%
  440. \def#2{\parsearg#1}%
  441. \def#1##1%
  442. }
  443. % Several utility definitions with active space:
  444. {
  445. \obeyspaces
  446. \gdef\obeyedspace{ }
  447. % Make each space character in the input produce a normal interword
  448. % space in the output. Don't allow a line break at this space, as this
  449. % is used only in environments like @example, where each line of input
  450. % should produce a line of output anyway.
  451. %
  452. \gdef\sepspaces{\obeyspaces\let =\tie}
  453. % If an index command is used in an @example environment, any spaces
  454. % therein should become regular spaces in the raw index file, not the
  455. % expansion of \tie (\leavevmode \penalty \@M \ ).
  456. \gdef\unsepspaces{\let =\space}
  457. }
  458. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  459. % Define the framework for environments in texinfo.tex. It's used like this:
  460. %
  461. % \envdef\foo{...}
  462. % \def\Efoo{...}
  463. %
  464. % It's the responsibility of \envdef to insert \begingroup before the
  465. % actual body; @end closes the group after calling \Efoo. \envdef also
  466. % defines \thisenv, so the current environment is known; @end checks
  467. % whether the environment name matches. The \checkenv macro can also be
  468. % used to check whether the current environment is the one expected.
  469. %
  470. % Non-false conditionals (@iftex, @ifset) don't fit into this, so they
  471. % are not treated as environments; they don't open a group. (The
  472. % implementation of @end takes care not to call \endgroup in this
  473. % special case.)
  474. % At run-time, environments start with this:
  475. \def\startenvironment#1{\begingroup\def\thisenv{#1}}
  476. % initialize
  477. \let\thisenv\empty
  478. % ... but they get defined via ``\envdef\foo{...}'':
  479. \long\def\envdef#1#2{\def#1{\startenvironment#1#2}}
  480. \def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}}
  481. % Check whether we're in the right environment:
  482. \def\checkenv#1{%
  483. \def\temp{#1}%
  484. \ifx\thisenv\temp
  485. \else
  486. \badenverr
  487. \fi
  488. }
  489. % Environment mismatch, #1 expected:
  490. \def\badenverr{%
  491. \errhelp = \EMsimple
  492. \errmessage{This command can appear only \inenvironment\temp,
  493. not \inenvironment\thisenv}%
  494. }
  495. \def\inenvironment#1{%
  496. \ifx#1\empty
  497. outside of any environment%
  498. \else
  499. in environment \expandafter\string#1%
  500. \fi
  501. }
  502. % @end foo executes the definition of \Efoo.
  503. % But first, it executes a specialized version of \checkenv
  504. %
  505. \parseargdef\end{%
  506. \if 1\csname iscond.#1\endcsname
  507. \else
  508. % The general wording of \badenverr may not be ideal.
  509. \expandafter\checkenv\csname#1\endcsname
  510. \csname E#1\endcsname
  511. \endgroup
  512. \fi
  513. }
  514. \newhelp\EMsimple{Press RETURN to continue.}
  515. % Be sure we're in horizontal mode when doing a tie, since we make space
  516. % equivalent to this in @example-like environments. Otherwise, a space
  517. % at the beginning of a line will start with \penalty -- and
  518. % since \penalty is valid in vertical mode, we'd end up putting the
  519. % penalty on the vertical list instead of in the new paragraph.
  520. {\catcode`@ = 11
  521. % Avoid using \@M directly, because that causes trouble
  522. % if the definition is written into an index file.
  523. \global\let\tiepenalty = \@M
  524. \gdef\tie{\leavevmode\penalty\tiepenalty\ }
  525. }
  526. % @: forces normal size whitespace following.
  527. \def\:{\spacefactor=1000 }
  528. % @* forces a line break.
  529. \def\*{\unskip\hfil\break\hbox{}\ignorespaces}
  530. % @/ allows a line break.
  531. \let\/=\allowbreak
  532. % @. is an end-of-sentence period.
  533. \def\.{.\spacefactor=\endofsentencespacefactor\space}
  534. % @! is an end-of-sentence bang.
  535. \def\!{!\spacefactor=\endofsentencespacefactor\space}
  536. % @? is an end-of-sentence query.
  537. \def\?{?\spacefactor=\endofsentencespacefactor\space}
  538. % @frenchspacing on|off says whether to put extra space after punctuation.
  539. %
  540. \def\onword{on}
  541. \def\offword{off}
  542. %
  543. \parseargdef\frenchspacing{%
  544. \def\temp{#1}%
  545. \ifx\temp\onword \plainfrenchspacing
  546. \else\ifx\temp\offword \plainnonfrenchspacing
  547. \else
  548. \errhelp = \EMsimple
  549. \errmessage{Unknown @frenchspacing option `\temp', must be on|off}%
  550. \fi\fi
  551. }
  552. % @w prevents a word break. Without the \leavevmode, @w at the
  553. % beginning of a paragraph, when TeX is still in vertical mode, would
  554. % produce a whole line of output instead of starting the paragraph.
  555. \def\w#1{\leavevmode\hbox{#1}}
  556. % @group ... @end group forces ... to be all on one page, by enclosing
  557. % it in a TeX vbox. We use \vtop instead of \vbox to construct the box
  558. % to keep its height that of a normal line. According to the rules for
  559. % \topskip (p.114 of the TeXbook), the glue inserted is
  560. % max (\topskip - \ht (first item), 0). If that height is large,
  561. % therefore, no glue is inserted, and the space between the headline and
  562. % the text is small, which looks bad.
  563. %
  564. % Another complication is that the group might be very large. This can
  565. % cause the glue on the previous page to be unduly stretched, because it
  566. % does not have much material. In this case, it's better to add an
  567. % explicit \vfill so that the extra space is at the bottom. The
  568. % threshold for doing this is if the group is more than \vfilllimit
  569. % percent of a page (\vfilllimit can be changed inside of @tex).
  570. %
  571. \newbox\groupbox
  572. \def\vfilllimit{0.7}
  573. %
  574. \envdef\group{%
  575. \ifnum\catcode`\^^M=\active \else
  576. \errhelp = \groupinvalidhelp
  577. \errmessage{@group invalid in context where filling is enabled}%
  578. \fi
  579. \startsavinginserts
  580. %
  581. \setbox\groupbox = \vtop\bgroup
  582. % Do @comment since we are called inside an environment such as
  583. % @example, where each end-of-line in the input causes an
  584. % end-of-line in the output. We don't want the end-of-line after
  585. % the `@group' to put extra space in the output. Since @group
  586. % should appear on a line by itself (according to the Texinfo
  587. % manual), we don't worry about eating any user text.
  588. \comment
  589. }
  590. %
  591. % The \vtop produces a box with normal height and large depth; thus, TeX puts
  592. % \baselineskip glue before it, and (when the next line of text is done)
  593. % \lineskip glue after it. Thus, space below is not quite equal to space
  594. % above. But it's pretty close.
  595. \def\Egroup{%
  596. % To get correct interline space between the last line of the group
  597. % and the first line afterwards, we have to propagate \prevdepth.
  598. \endgraf % Not \par, as it may have been set to \lisppar.
  599. \global\dimen1 = \prevdepth
  600. \egroup % End the \vtop.
  601. \addgroupbox
  602. \prevdepth = \dimen1
  603. \checkinserts
  604. }
  605. \def\addgroupbox{
  606. % \dimen0 is the vertical size of the group's box.
  607. \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox
  608. % \dimen2 is how much space is left on the page (more or less).
  609. \dimen2 = \txipageheight \advance\dimen2 by -\pagetotal
  610. % if the group doesn't fit on the current page, and it's a big big
  611. % group, force a page break.
  612. \ifdim \dimen0 > \dimen2
  613. \ifdim \pagetotal < \vfilllimit\txipageheight
  614. \page
  615. \fi
  616. \fi
  617. \box\groupbox
  618. }
  619. %
  620. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  621. % message, so this ends up printing `@group can only ...'.
  622. %
  623. \newhelp\groupinvalidhelp{%
  624. group can only be used in environments such as @example,^^J%
  625. where each line of input produces a line of output.}
  626. % @need space-in-mils
  627. % forces a page break if there is not space-in-mils remaining.
  628. \newdimen\mil \mil=0.001in
  629. \parseargdef\need{%
  630. % Ensure vertical mode, so we don't make a big box in the middle of a
  631. % paragraph.
  632. \par
  633. %
  634. % If the @need value is less than one line space, it's useless.
  635. \dimen0 = #1\mil
  636. \dimen2 = \ht\strutbox
  637. \advance\dimen2 by \dp\strutbox
  638. \ifdim\dimen0 > \dimen2
  639. %
  640. % Do a \strut just to make the height of this box be normal, so the
  641. % normal leading is inserted relative to the preceding line.
  642. % And a page break here is fine.
  643. \vtop to #1\mil{\strut\vfil}%
  644. %
  645. % TeX does not even consider page breaks if a penalty added to the
  646. % main vertical list is 10000 or more. But in order to see if the
  647. % empty box we just added fits on the page, we must make it consider
  648. % page breaks. On the other hand, we don't want to actually break the
  649. % page after the empty box. So we use a penalty of 9999.
  650. %
  651. % There is an extremely small chance that TeX will actually break the
  652. % page at this \penalty, if there are no other feasible breakpoints in
  653. % sight. (If the user is using lots of big @group commands, which
  654. % almost-but-not-quite fill up a page, TeX will have a hard time doing
  655. % good page breaking, for example.) However, I could not construct an
  656. % example where a page broke at this \penalty; if it happens in a real
  657. % document, then we can reconsider our strategy.
  658. \penalty9999
  659. %
  660. % Back up by the size of the box, whether we did a page break or not.
  661. \kern -#1\mil
  662. %
  663. % Do not allow a page break right after this kern.
  664. \nobreak
  665. \fi
  666. }
  667. % @br forces paragraph break (and is undocumented).
  668. \let\br = \par
  669. % @page forces the start of a new page.
  670. %
  671. \def\page{\par\vfill\supereject}
  672. % @exdent text....
  673. % outputs text on separate line in roman font, starting at standard page margin
  674. % This records the amount of indent in the innermost environment.
  675. % That's how much \exdent should take out.
  676. \newskip\exdentamount
  677. % This defn is used inside fill environments such as @defun.
  678. \parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}
  679. % This defn is used inside nofill environments such as @example.
  680. \parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount
  681. \leftline{\hskip\leftskip{\rm#1}}}}
  682. % @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current
  683. % paragraph. For more general purposes, use the \margin insertion
  684. % class. WHICH is `l' or `r'. Not documented, written for gawk manual.
  685. %
  686. \newskip\inmarginspacing \inmarginspacing=1cm
  687. \def\strutdepth{\dp\strutbox}
  688. %
  689. \def\doinmargin#1#2{\strut\vadjust{%
  690. \nobreak
  691. \kern-\strutdepth
  692. \vtop to \strutdepth{%
  693. \baselineskip=\strutdepth
  694. \vss
  695. % if you have multiple lines of stuff to put here, you'll need to
  696. % make the vbox yourself of the appropriate size.
  697. \ifx#1l%
  698. \llap{\ignorespaces #2\hskip\inmarginspacing}%
  699. \else
  700. \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}%
  701. \fi
  702. \null
  703. }%
  704. }}
  705. \def\inleftmargin{\doinmargin l}
  706. \def\inrightmargin{\doinmargin r}
  707. %
  708. % @inmargin{TEXT [, RIGHT-TEXT]}
  709. % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right;
  710. % else use TEXT for both).
  711. %
  712. \def\inmargin#1{\parseinmargin #1,,\finish}
  713. \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing.
  714. \setbox0 = \hbox{\ignorespaces #2}%
  715. \ifdim\wd0 > 0pt
  716. \def\lefttext{#1}% have both texts
  717. \def\righttext{#2}%
  718. \else
  719. \def\lefttext{#1}% have only one text
  720. \def\righttext{#1}%
  721. \fi
  722. %
  723. \ifodd\pageno
  724. \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin
  725. \else
  726. \def\temp{\inleftmargin\lefttext}%
  727. \fi
  728. \temp
  729. }
  730. % @include FILE -- \input text of FILE.
  731. %
  732. \def\include{\parseargusing\filenamecatcodes\includezzz}
  733. \def\includezzz#1{%
  734. \pushthisfilestack
  735. \def\thisfile{#1}%
  736. {%
  737. \makevalueexpandable % we want to expand any @value in FILE.
  738. \turnoffactive % and allow special characters in the expansion
  739. \indexnofonts % Allow `@@' and other weird things in file names.
  740. \wlog{texinfo.tex: doing @include of #1^^J}%
  741. \edef\temp{\noexpand\input #1 }%
  742. %
  743. % This trickery is to read FILE outside of a group, in case it makes
  744. % definitions, etc.
  745. \expandafter
  746. }\temp
  747. \popthisfilestack
  748. }
  749. \def\filenamecatcodes{%
  750. \catcode`\\=\other
  751. \catcode`~=\other
  752. \catcode`^=\other
  753. \catcode`_=\other
  754. \catcode`|=\other
  755. \catcode`<=\other
  756. \catcode`>=\other
  757. \catcode`+=\other
  758. \catcode`-=\other
  759. \catcode`\`=\other
  760. \catcode`\'=\other
  761. }
  762. \def\pushthisfilestack{%
  763. \expandafter\pushthisfilestackX\popthisfilestack\StackTerm
  764. }
  765. \def\pushthisfilestackX{%
  766. \expandafter\pushthisfilestackY\thisfile\StackTerm
  767. }
  768. \def\pushthisfilestackY #1\StackTerm #2\StackTerm {%
  769. \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}%
  770. }
  771. \def\popthisfilestack{\errthisfilestackempty}
  772. \def\errthisfilestackempty{\errmessage{Internal error:
  773. the stack of filenames is empty.}}
  774. %
  775. \def\thisfile{}
  776. % @center line
  777. % outputs that line, centered.
  778. %
  779. \parseargdef\center{%
  780. \ifhmode
  781. \let\centersub\centerH
  782. \else
  783. \let\centersub\centerV
  784. \fi
  785. \centersub{\hfil \ignorespaces#1\unskip \hfil}%
  786. \let\centersub\relax % don't let the definition persist, just in case
  787. }
  788. \def\centerH#1{{%
  789. \hfil\break
  790. \advance\hsize by -\leftskip
  791. \advance\hsize by -\rightskip
  792. \line{#1}%
  793. \break
  794. }}
  795. %
  796. \newcount\centerpenalty
  797. \def\centerV#1{%
  798. % The idea here is the same as in \startdefun, \cartouche, etc.: if
  799. % @center is the first thing after a section heading, we need to wipe
  800. % out the negative parskip inserted by \sectionheading, but still
  801. % prevent a page break here.
  802. \centerpenalty = \lastpenalty
  803. \ifnum\centerpenalty>10000 \vskip\parskip \fi
  804. \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
  805. \line{\kern\leftskip #1\kern\rightskip}%
  806. }
  807. % @sp n outputs n lines of vertical space
  808. %
  809. \parseargdef\sp{\vskip #1\baselineskip}
  810. % @comment ...line which is ignored...
  811. % @c is the same as @comment
  812. % @ignore ... @end ignore is another way to write a comment
  813. \def\c{\begingroup \catcode`\^^M=\active%
  814. \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
  815. \cxxx}
  816. {\catcode`\^^M=\active \gdef\cxxx#1^^M{\endgroup}}
  817. %
  818. \let\comment\c
  819. % @paragraphindent NCHARS
  820. % We'll use ems for NCHARS, close enough.
  821. % NCHARS can also be the word `asis' or `none'.
  822. % We cannot feasibly implement @paragraphindent asis, though.
  823. %
  824. \def\asisword{asis} % no translation, these are keywords
  825. \def\noneword{none}
  826. %
  827. \parseargdef\paragraphindent{%
  828. \def\temp{#1}%
  829. \ifx\temp\asisword
  830. \else
  831. \ifx\temp\noneword
  832. \defaultparindent = 0pt
  833. \else
  834. \defaultparindent = #1em
  835. \fi
  836. \fi
  837. \parindent = \defaultparindent
  838. }
  839. % @exampleindent NCHARS
  840. % We'll use ems for NCHARS like @paragraphindent.
  841. % It seems @exampleindent asis isn't necessary, but
  842. % I preserve it to make it similar to @paragraphindent.
  843. \parseargdef\exampleindent{%
  844. \def\temp{#1}%
  845. \ifx\temp\asisword
  846. \else
  847. \ifx\temp\noneword
  848. \lispnarrowing = 0pt
  849. \else
  850. \lispnarrowing = #1em
  851. \fi
  852. \fi
  853. }
  854. % @firstparagraphindent WORD
  855. % If WORD is `none', then suppress indentation of the first paragraph
  856. % after a section heading. If WORD is `insert', then do indent at such
  857. % paragraphs.
  858. %
  859. % The paragraph indentation is suppressed or not by calling
  860. % \suppressfirstparagraphindent, which the sectioning commands do.
  861. % We switch the definition of this back and forth according to WORD.
  862. % By default, we suppress indentation.
  863. %
  864. \def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent}
  865. \def\insertword{insert}
  866. %
  867. \parseargdef\firstparagraphindent{%
  868. \def\temp{#1}%
  869. \ifx\temp\noneword
  870. \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent
  871. \else\ifx\temp\insertword
  872. \let\suppressfirstparagraphindent = \relax
  873. \else
  874. \errhelp = \EMsimple
  875. \errmessage{Unknown @firstparagraphindent option `\temp'}%
  876. \fi\fi
  877. }
  878. % Here is how we actually suppress indentation. Redefine \everypar to
  879. % \kern backwards by \parindent, and then reset itself to empty.
  880. %
  881. % We also make \indent itself not actually do anything until the next
  882. % paragraph.
  883. %
  884. \gdef\dosuppressfirstparagraphindent{%
  885. \gdef\indent {\restorefirstparagraphindent \indent}%
  886. \gdef\noindent{\restorefirstparagraphindent \noindent}%
  887. \global\everypar = {\kern -\parindent \restorefirstparagraphindent}%
  888. }
  889. %
  890. \gdef\restorefirstparagraphindent{%
  891. \global\let\indent = \ptexindent
  892. \global\let\noindent = \ptexnoindent
  893. \global\everypar = {}%
  894. }
  895. % @refill is a no-op.
  896. \let\refill=\relax
  897. % @setfilename INFO-FILENAME - ignored
  898. \let\setfilename=\comment
  899. % @bye.
  900. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  901. \message{pdf,}
  902. % adobe `portable' document format
  903. \newcount\tempnum
  904. \newcount\lnkcount
  905. \newtoks\filename
  906. \newcount\filenamelength
  907. \newcount\pgn
  908. \newtoks\toksA
  909. \newtoks\toksB
  910. \newtoks\toksC
  911. \newtoks\toksD
  912. \newbox\boxA
  913. \newbox\boxB
  914. \newcount\countA
  915. \newif\ifpdf
  916. \newif\ifpdfmakepagedest
  917. %
  918. % For LuaTeX
  919. %
  920. \newif\iftxiuseunicodedestname
  921. \txiuseunicodedestnamefalse % For pdfTeX etc.
  922. \ifx\luatexversion\thisisundefined
  923. \else
  924. % Use Unicode destination names
  925. \txiuseunicodedestnametrue
  926. % Escape PDF strings with converting UTF-16 from UTF-8
  927. \begingroup
  928. \catcode`\%=12
  929. \directlua{
  930. function UTF16oct(str)
  931. tex.sprint(string.char(0x5c) .. '376' .. string.char(0x5c) .. '377')
  932. for c in string.utfvalues(str) do
  933. if c < 0x10000 then
  934. tex.sprint(
  935. string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
  936. string.char(0x5c) .. string.char(0x25) .. '03o',
  937. (c / 256), (c % 256)))
  938. else
  939. c = c - 0x10000
  940. local c_hi = c / 1024 + 0xd800
  941. local c_lo = c % 1024 + 0xdc00
  942. tex.sprint(
  943. string.format(string.char(0x5c) .. string.char(0x25) .. '03o' ..
  944. string.char(0x5c) .. string.char(0x25) .. '03o' ..
  945. string.char(0x5c) .. string.char(0x25) .. '03o' ..
  946. string.char(0x5c) .. string.char(0x25) .. '03o',
  947. (c_hi / 256), (c_hi % 256),
  948. (c_lo / 256), (c_lo % 256)))
  949. end
  950. end
  951. end
  952. }
  953. \endgroup
  954. \def\pdfescapestrutfsixteen#1{\directlua{UTF16oct('\luaescapestring{#1}')}}
  955. % Escape PDF strings without converting
  956. \begingroup
  957. \directlua{
  958. function PDFescstr(str)
  959. for c in string.bytes(str) do
  960. if c <= 0x20 or c >= 0x80 or c == 0x28 or c == 0x29 or c == 0x5c then
  961. tex.sprint(
  962. string.format(string.char(0x5c) .. string.char(0x25) .. '03o',
  963. c))
  964. else
  965. tex.sprint(string.char(c))
  966. end
  967. end
  968. end
  969. }
  970. \endgroup
  971. \def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
  972. \ifnum\luatexversion>84
  973. % For LuaTeX >= 0.85
  974. \def\pdfdest{\pdfextension dest}
  975. \let\pdfoutput\outputmode
  976. \def\pdfliteral{\pdfextension literal}
  977. \def\pdfcatalog{\pdfextension catalog}
  978. \def\pdftexversion{\numexpr\pdffeedback version\relax}
  979. \let\pdfximage\saveimageresource
  980. \let\pdfrefximage\useimageresource
  981. \let\pdflastximage\lastsavedimageresourceindex
  982. \def\pdfendlink{\pdfextension endlink\relax}
  983. \def\pdfoutline{\pdfextension outline}
  984. \def\pdfstartlink{\pdfextension startlink}
  985. \def\pdffontattr{\pdfextension fontattr}
  986. \def\pdfobj{\pdfextension obj}
  987. \def\pdflastobj{\numexpr\pdffeedback lastobj\relax}
  988. \let\pdfpagewidth\pagewidth
  989. \let\pdfpageheight\pageheight
  990. \edef\pdfhorigin{\pdfvariable horigin}
  991. \edef\pdfvorigin{\pdfvariable vorigin}
  992. \fi
  993. \fi
  994. % when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
  995. % can be set). So we test for \relax and 0 as well as being undefined.
  996. \ifx\pdfoutput\thisisundefined
  997. \else
  998. \ifx\pdfoutput\relax
  999. \else
  1000. \ifcase\pdfoutput
  1001. \else
  1002. \pdftrue
  1003. \fi
  1004. \fi
  1005. \fi
  1006. % PDF uses PostScript string constants for the names of xref targets,
  1007. % for display in the outlines, and in other places. Thus, we have to
  1008. % double any backslashes. Otherwise, a name like "\node" will be
  1009. % interpreted as a newline (\n), followed by o, d, e. Not good.
  1010. %
  1011. % See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
  1012. % related messages. The final outcome is that it is up to the TeX user
  1013. % to double the backslashes and otherwise make the string valid, so
  1014. % that's what we do. pdftex 1.30.0 (ca.2005) introduced a primitive to
  1015. % do this reliably, so we use it.
  1016. % #1 is a control sequence in which to do the replacements,
  1017. % which we \xdef.
  1018. \def\txiescapepdf#1{%
  1019. \ifx\pdfescapestring\thisisundefined
  1020. % No primitive available; should we give a warning or log?
  1021. % Many times it won't matter.
  1022. \xdef#1{#1}%
  1023. \else
  1024. % The expandable \pdfescapestring primitive escapes parentheses,
  1025. % backslashes, and other special chars.
  1026. \xdef#1{\pdfescapestring{#1}}%
  1027. \fi
  1028. }
  1029. \def\txiescapepdfutfsixteen#1{%
  1030. \ifx\pdfescapestrutfsixteen\thisisundefined
  1031. % No UTF-16 converting macro available.
  1032. \txiescapepdf{#1}%
  1033. \else
  1034. \xdef#1{\pdfescapestrutfsixteen{#1}}%
  1035. \fi
  1036. }
  1037. \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
  1038. with PDF output, and none of those formats could be found. (.eps cannot
  1039. be supported due to the design of the PDF format; use regular TeX (DVI
  1040. output) for that.)}
  1041. \ifpdf
  1042. %
  1043. % Color manipulation macros using ideas from pdfcolor.tex,
  1044. % except using rgb instead of cmyk; the latter is said to render as a
  1045. % very dark gray on-screen and a very dark halftone in print, instead
  1046. % of actual black. The dark red here is dark enough to print on paper as
  1047. % nearly black, but still distinguishable for online viewing. We use
  1048. % black by default, though.
  1049. \def\rgbDarkRed{0.50 0.09 0.12}
  1050. \def\rgbBlack{0 0 0}
  1051. %
  1052. % rg sets the color for filling (usual text, etc.);
  1053. % RG sets the color for stroking (thin rules, e.g., normal _'s).
  1054. \def\pdfsetcolor#1{\pdfliteral{#1 rg #1 RG}}
  1055. %
  1056. % Set color, and create a mark which defines \thiscolor accordingly,
  1057. % so that \makeheadline knows which color to restore.
  1058. \def\setcolor#1{%
  1059. \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
  1060. \domark
  1061. \pdfsetcolor{#1}%
  1062. }
  1063. %
  1064. \def\maincolor{\rgbBlack}
  1065. \pdfsetcolor{\maincolor}
  1066. \edef\thiscolor{\maincolor}
  1067. \def\lastcolordefs{}
  1068. %
  1069. \def\makefootline{%
  1070. \baselineskip24pt
  1071. \line{\pdfsetcolor{\maincolor}\the\footline}%
  1072. }
  1073. %
  1074. \def\makeheadline{%
  1075. \vbox to 0pt{%
  1076. \vskip-22.5pt
  1077. \line{%
  1078. \vbox to8.5pt{}%
  1079. % Extract \thiscolor definition from the marks.
  1080. \getcolormarks
  1081. % Typeset the headline with \maincolor, then restore the color.
  1082. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
  1083. }%
  1084. \vss
  1085. }%
  1086. \nointerlineskip
  1087. }
  1088. %
  1089. %
  1090. \pdfcatalog{/PageMode /UseOutlines}
  1091. %
  1092. % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  1093. \def\dopdfimage#1#2#3{%
  1094. \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
  1095. \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
  1096. %
  1097. % pdftex (and the PDF format) support .pdf, .png, .jpg (among
  1098. % others). Let's try in that order, PDF first since if
  1099. % someone has a scalable image, presumably better to use that than a
  1100. % bitmap.
  1101. \let\pdfimgext=\empty
  1102. \begingroup
  1103. \openin 1 #1.pdf \ifeof 1
  1104. \openin 1 #1.PDF \ifeof 1
  1105. \openin 1 #1.png \ifeof 1
  1106. \openin 1 #1.jpg \ifeof 1
  1107. \openin 1 #1.jpeg \ifeof 1
  1108. \openin 1 #1.JPG \ifeof 1
  1109. \errhelp = \nopdfimagehelp
  1110. \errmessage{Could not find image file #1 for pdf}%
  1111. \else \gdef\pdfimgext{JPG}%
  1112. \fi
  1113. \else \gdef\pdfimgext{jpeg}%
  1114. \fi
  1115. \else \gdef\pdfimgext{jpg}%
  1116. \fi
  1117. \else \gdef\pdfimgext{png}%
  1118. \fi
  1119. \else \gdef\pdfimgext{PDF}%
  1120. \fi
  1121. \else \gdef\pdfimgext{pdf}%
  1122. \fi
  1123. \closein 1
  1124. \endgroup
  1125. %
  1126. % without \immediate, ancient pdftex seg faults when the same image is
  1127. % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.)
  1128. \ifnum\pdftexversion < 14
  1129. \immediate\pdfimage
  1130. \else
  1131. \immediate\pdfximage
  1132. \fi
  1133. \ifdim \wd0 >0pt width \pdfimagewidth \fi
  1134. \ifdim \wd2 >0pt height \pdfimageheight \fi
  1135. \ifnum\pdftexversion<13
  1136. #1.\pdfimgext
  1137. \else
  1138. {#1.\pdfimgext}%
  1139. \fi
  1140. \ifnum\pdftexversion < 14 \else
  1141. \pdfrefximage \pdflastximage
  1142. \fi}
  1143. %
  1144. \def\setpdfdestname#1{{%
  1145. % We have to set dummies so commands such as @code, and characters
  1146. % such as \, aren't expanded when present in a section title.
  1147. \indexnofonts
  1148. \makevalueexpandable
  1149. \turnoffactive
  1150. \iftxiuseunicodedestname
  1151. \ifx \declaredencoding \latone
  1152. % Pass through Latin-1 characters.
  1153. % LuaTeX with byte wise I/O converts Latin-1 characters to Unicode.
  1154. \else
  1155. \ifx \declaredencoding \utfeight
  1156. % Pass through Unicode characters.
  1157. \else
  1158. % Use ASCII approximations in destination names.
  1159. \passthroughcharsfalse
  1160. \fi
  1161. \fi
  1162. \else
  1163. % Use ASCII approximations in destination names.
  1164. \passthroughcharsfalse
  1165. \fi
  1166. \def\pdfdestname{#1}%
  1167. \txiescapepdf\pdfdestname
  1168. }}
  1169. %
  1170. \def\setpdfoutlinetext#1{{%
  1171. \indexnofonts
  1172. \makevalueexpandable
  1173. \turnoffactive
  1174. \ifx \declaredencoding \latone
  1175. % The PDF format can use an extended form of Latin-1 in bookmark
  1176. % strings. See Appendix D of the PDF Reference, Sixth Edition, for
  1177. % the "PDFDocEncoding".
  1178. \passthroughcharstrue
  1179. % Pass through Latin-1 characters.
  1180. % LuaTeX: Convert to Unicode
  1181. % pdfTeX: Use Latin-1 as PDFDocEncoding
  1182. \def\pdfoutlinetext{#1}%
  1183. \else
  1184. \ifx \declaredencoding \utfeight
  1185. \ifx\luatexversion\thisisundefined
  1186. % For pdfTeX with UTF-8.
  1187. % TODO: the PDF format can use UTF-16 in bookmark strings,
  1188. % but the code for this isn't done yet.
  1189. % Use ASCII approximations.
  1190. \passthroughcharsfalse
  1191. \def\pdfoutlinetext{#1}%
  1192. \else
  1193. % For LuaTeX with UTF-8.
  1194. % Pass through Unicode characters for title texts.
  1195. \passthroughcharstrue
  1196. \def\pdfoutlinetext{#1}%
  1197. \fi
  1198. \else
  1199. % For non-Latin-1 or non-UTF-8 encodings.
  1200. % Use ASCII approximations.
  1201. \passthroughcharsfalse
  1202. \def\pdfoutlinetext{#1}%
  1203. \fi
  1204. \fi
  1205. % LuaTeX: Convert to UTF-16
  1206. % pdfTeX: Use Latin-1 as PDFDocEncoding
  1207. \txiescapepdfutfsixteen\pdfoutlinetext
  1208. }}
  1209. %
  1210. \def\pdfmkdest#1{%
  1211. \setpdfdestname{#1}%
  1212. \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  1213. }
  1214. %
  1215. % used to mark target names; must be expandable.
  1216. \def\pdfmkpgn#1{#1}
  1217. %
  1218. % by default, use black for everything.
  1219. \def\urlcolor{\rgbBlack}
  1220. \def\linkcolor{\rgbBlack}
  1221. \def\endlink{\setcolor{\maincolor}\pdfendlink}
  1222. %
  1223. % Adding outlines to PDF; macros for calculating structure of outlines
  1224. % come from Petr Olsak
  1225. \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
  1226. \else \csname#1\endcsname \fi}
  1227. \def\advancenumber#1{\tempnum=\expnumber{#1}\relax
  1228. \advance\tempnum by 1
  1229. \expandafter\xdef\csname#1\endcsname{\the\tempnum}}
  1230. %
  1231. % #1 is the section text, which is what will be displayed in the
  1232. % outline by the pdf viewer. #2 is the pdf expression for the number
  1233. % of subentries (or empty, for subsubsections). #3 is the node text,
  1234. % which might be empty if this toc entry had no corresponding node.
  1235. % #4 is the page number
  1236. %
  1237. \def\dopdfoutline#1#2#3#4{%
  1238. % Generate a link to the node text if that exists; else, use the
  1239. % page number. We could generate a destination for the section
  1240. % text in the case where a section has no node, but it doesn't
  1241. % seem worth the trouble, since most documents are normally structured.
  1242. \setpdfoutlinetext{#1}
  1243. \setpdfdestname{#3}
  1244. \ifx\pdfdestname\empty
  1245. \def\pdfdestname{#4}%
  1246. \fi
  1247. %
  1248. \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
  1249. }
  1250. %
  1251. \def\pdfmakeoutlines{%
  1252. \begingroup
  1253. % Read toc silently, to get counts of subentries for \pdfoutline.
  1254. \def\partentry##1##2##3##4{}% ignore parts in the outlines
  1255. \def\numchapentry##1##2##3##4{%
  1256. \def\thischapnum{##2}%
  1257. \def\thissecnum{0}%
  1258. \def\thissubsecnum{0}%
  1259. }%
  1260. \def\numsecentry##1##2##3##4{%
  1261. \advancenumber{chap\thischapnum}%
  1262. \def\thissecnum{##2}%
  1263. \def\thissubsecnum{0}%
  1264. }%
  1265. \def\numsubsecentry##1##2##3##4{%
  1266. \advancenumber{sec\thissecnum}%
  1267. \def\thissubsecnum{##2}%
  1268. }%
  1269. \def\numsubsubsecentry##1##2##3##4{%
  1270. \advancenumber{subsec\thissubsecnum}%
  1271. }%
  1272. \def\thischapnum{0}%
  1273. \def\thissecnum{0}%
  1274. \def\thissubsecnum{0}%
  1275. %
  1276. % use \def rather than \let here because we redefine \chapentry et
  1277. % al. a second time, below.
  1278. \def\appentry{\numchapentry}%
  1279. \def\appsecentry{\numsecentry}%
  1280. \def\appsubsecentry{\numsubsecentry}%
  1281. \def\appsubsubsecentry{\numsubsubsecentry}%
  1282. \def\unnchapentry{\numchapentry}%
  1283. \def\unnsecentry{\numsecentry}%
  1284. \def\unnsubsecentry{\numsubsecentry}%
  1285. \def\unnsubsubsecentry{\numsubsubsecentry}%
  1286. \readdatafile{toc}%
  1287. %
  1288. % Read toc second time, this time actually producing the outlines.
  1289. % The `-' means take the \expnumber as the absolute number of
  1290. % subentries, which we calculated on our first read of the .toc above.
  1291. %
  1292. % We use the node names as the destinations.
  1293. \def\numchapentry##1##2##3##4{%
  1294. \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}%
  1295. \def\numsecentry##1##2##3##4{%
  1296. \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}%
  1297. \def\numsubsecentry##1##2##3##4{%
  1298. \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}%
  1299. \def\numsubsubsecentry##1##2##3##4{% count is always zero
  1300. \dopdfoutline{##1}{}{##3}{##4}}%
  1301. %
  1302. % PDF outlines are displayed using system fonts, instead of
  1303. % document fonts. Therefore we cannot use special characters,
  1304. % since the encoding is unknown. For example, the eogonek from
  1305. % Latin 2 (0xea) gets translated to a | character. Info from
  1306. % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
  1307. %
  1308. % TODO this right, we have to translate 8-bit characters to
  1309. % their "best" equivalent, based on the @documentencoding. Too
  1310. % much work for too little return. Just use the ASCII equivalents
  1311. % we use for the index sort strings.
  1312. %
  1313. \indexnofonts
  1314. \setupdatafile
  1315. % We can have normal brace characters in the PDF outlines, unlike
  1316. % Texinfo index files. So set that up.
  1317. \def\{{\lbracecharliteral}%
  1318. \def\}{\rbracecharliteral}%
  1319. \catcode`\\=\active \otherbackslash
  1320. \input \tocreadfilename
  1321. \endgroup
  1322. }
  1323. {\catcode`[=1 \catcode`]=2
  1324. \catcode`{=\other \catcode`}=\other
  1325. \gdef\lbracecharliteral[{]%
  1326. \gdef\rbracecharliteral[}]%
  1327. ]
  1328. %
  1329. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1330. \ifx\PP\D\let\nextsp\relax
  1331. \else\let\nextsp\skipspaces
  1332. \addtokens{\filename}{\PP}%
  1333. \advance\filenamelength by 1
  1334. \fi
  1335. \nextsp}
  1336. \def\getfilename#1{%
  1337. \filenamelength=0
  1338. % If we don't expand the argument now, \skipspaces will get
  1339. % snagged on things like "@value{foo}".
  1340. \edef\temp{#1}%
  1341. \expandafter\skipspaces\temp|\relax
  1342. }
  1343. \ifnum\pdftexversion < 14
  1344. \let \startlink \pdfannotlink
  1345. \else
  1346. \let \startlink \pdfstartlink
  1347. \fi
  1348. % make a live url in pdf output.
  1349. \def\pdfurl#1{%
  1350. \begingroup
  1351. % it seems we really need yet another set of dummies; have not
  1352. % tried to figure out what each command should do in the context
  1353. % of @url. for now, just make @/ a no-op, that's the only one
  1354. % people have actually reported a problem with.
  1355. %
  1356. \normalturnoffactive
  1357. \def\@{@}%
  1358. \let\/=\empty
  1359. \makevalueexpandable
  1360. % do we want to go so far as to use \indexnofonts instead of just
  1361. % special-casing \var here?
  1362. \def\var##1{##1}%
  1363. %
  1364. \leavevmode\setcolor{\urlcolor}%
  1365. \startlink attr{/Border [0 0 0]}%
  1366. user{/Subtype /Link /A << /S /URI /URI (#1) >>}%
  1367. \endgroup}
  1368. % \pdfgettoks - Surround page numbers in #1 with @pdflink. #1 may
  1369. % be a simple number, or a list of numbers in the case of an index
  1370. % entry.
  1371. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1372. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1373. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1374. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1375. \def\maketoks{%
  1376. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1377. \ifx\first0\adn0
  1378. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1379. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1380. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1381. \else
  1382. \ifnum0=\countA\else\makelink\fi
  1383. \ifx\first.\let\next=\done\else
  1384. \let\next=\maketoks
  1385. \addtokens{\toksB}{\the\toksD}
  1386. \ifx\first,\addtokens{\toksB}{\space}\fi
  1387. \fi
  1388. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1389. \next}
  1390. \def\makelink{\addtokens{\toksB}%
  1391. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1392. \def\pdflink#1{%
  1393. \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
  1394. \setcolor{\linkcolor}#1\endlink}
  1395. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1396. \else
  1397. % non-pdf mode
  1398. \let\pdfmkdest = \gobble
  1399. \let\pdfurl = \gobble
  1400. \let\endlink = \relax
  1401. \let\setcolor = \gobble
  1402. \let\pdfsetcolor = \gobble
  1403. \let\pdfmakeoutlines = \relax
  1404. \fi % \ifx\pdfoutput
  1405. %
  1406. % For XeTeX
  1407. %
  1408. \ifx\XeTeXrevision\thisisundefined
  1409. \else
  1410. %
  1411. % XeTeX version check
  1412. %
  1413. \ifnum\strcmp{\the\XeTeXversion\XeTeXrevision}{0.99996}>-1
  1414. % TeX Live 2016 contains XeTeX 0.99996 and xdvipdfmx 20160307.
  1415. % It can use the `dvipdfmx:config' special (from TeX Live SVN r40941).
  1416. % For avoiding PDF destination name replacement, we use this special
  1417. % instead of xdvipdfmx's command line option `-C 0x0010'.
  1418. \special{dvipdfmx:config C 0x0010}
  1419. % XeTeX 0.99995+ comes with xdvipdfmx 20160307+.
  1420. % It can handle Unicode destination names for PDF.
  1421. \txiuseunicodedestnametrue
  1422. \else
  1423. % XeTeX < 0.99996 (TeX Live < 2016) cannot use the
  1424. % `dvipdfmx:config' special.
  1425. % So for avoiding PDF destination name replacement,
  1426. % xdvipdfmx's command line option `-C 0x0010' is necessary.
  1427. %
  1428. % XeTeX < 0.99995 can not handle Unicode destination names for PDF
  1429. % because xdvipdfmx 20150315 has a UTF-16 conversion issue.
  1430. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
  1431. \txiuseunicodedestnamefalse
  1432. \fi
  1433. %
  1434. % Color support
  1435. %
  1436. \def\rgbDarkRed{0.50 0.09 0.12}
  1437. \def\rgbBlack{0 0 0}
  1438. %
  1439. \def\pdfsetcolor#1{\special{pdf:scolor [#1]}}
  1440. %
  1441. % Set color, and create a mark which defines \thiscolor accordingly,
  1442. % so that \makeheadline knows which color to restore.
  1443. \def\setcolor#1{%
  1444. \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
  1445. \domark
  1446. \pdfsetcolor{#1}%
  1447. }
  1448. %
  1449. \def\maincolor{\rgbBlack}
  1450. \pdfsetcolor{\maincolor}
  1451. \edef\thiscolor{\maincolor}
  1452. \def\lastcolordefs{}
  1453. %
  1454. \def\makefootline{%
  1455. \baselineskip24pt
  1456. \line{\pdfsetcolor{\maincolor}\the\footline}%
  1457. }
  1458. %
  1459. \def\makeheadline{%
  1460. \vbox to 0pt{%
  1461. \vskip-22.5pt
  1462. \line{%
  1463. \vbox to8.5pt{}%
  1464. % Extract \thiscolor definition from the marks.
  1465. \getcolormarks
  1466. % Typeset the headline with \maincolor, then restore the color.
  1467. \pdfsetcolor{\maincolor}\the\headline\pdfsetcolor{\thiscolor}%
  1468. }%
  1469. \vss
  1470. }%
  1471. \nointerlineskip
  1472. }
  1473. %
  1474. % PDF outline support
  1475. %
  1476. % Emulate pdfTeX primitive
  1477. \def\pdfdest name#1 xyz{%
  1478. \special{pdf:dest (#1) [@thispage /XYZ @xpos @ypos null]}%
  1479. }
  1480. %
  1481. \def\setpdfdestname#1{{%
  1482. % We have to set dummies so commands such as @code, and characters
  1483. % such as \, aren't expanded when present in a section title.
  1484. \indexnofonts
  1485. \makevalueexpandable
  1486. \turnoffactive
  1487. \iftxiuseunicodedestname
  1488. % Pass through Unicode characters.
  1489. \else
  1490. % Use ASCII approximations in destination names.
  1491. \passthroughcharsfalse
  1492. \fi
  1493. \def\pdfdestname{#1}%
  1494. \txiescapepdf\pdfdestname
  1495. }}
  1496. %
  1497. \def\setpdfoutlinetext#1{{%
  1498. \turnoffactive
  1499. % Always use Unicode characters in title texts.
  1500. \def\pdfoutlinetext{#1}%
  1501. % For XeTeX, xdvipdfmx converts to UTF-16.
  1502. % So we do not convert.
  1503. \txiescapepdf\pdfoutlinetext
  1504. }}
  1505. %
  1506. \def\pdfmkdest#1{%
  1507. \setpdfdestname{#1}%
  1508. \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
  1509. }
  1510. %
  1511. % by default, use black for everything.
  1512. \def\urlcolor{\rgbBlack}
  1513. \def\linkcolor{\rgbBlack}
  1514. \def\endlink{\setcolor{\maincolor}\pdfendlink}
  1515. %
  1516. \def\dopdfoutline#1#2#3#4{%
  1517. \setpdfoutlinetext{#1}
  1518. \setpdfdestname{#3}
  1519. \ifx\pdfdestname\empty
  1520. \def\pdfdestname{#4}%
  1521. \fi
  1522. %
  1523. \special{pdf:out [-] #2 << /Title (\pdfoutlinetext) /A
  1524. << /S /GoTo /D (\pdfdestname) >> >> }%
  1525. }
  1526. %
  1527. \def\pdfmakeoutlines{%
  1528. \begingroup
  1529. %
  1530. % For XeTeX, counts of subentries are not necessary.
  1531. % Therefore, we read toc only once.
  1532. %
  1533. % We use node names as destinations.
  1534. \def\partentry##1##2##3##4{}% ignore parts in the outlines
  1535. \def\numchapentry##1##2##3##4{%
  1536. \dopdfoutline{##1}{1}{##3}{##4}}%
  1537. \def\numsecentry##1##2##3##4{%
  1538. \dopdfoutline{##1}{2}{##3}{##4}}%
  1539. \def\numsubsecentry##1##2##3##4{%
  1540. \dopdfoutline{##1}{3}{##3}{##4}}%
  1541. \def\numsubsubsecentry##1##2##3##4{%
  1542. \dopdfoutline{##1}{4}{##3}{##4}}%
  1543. %
  1544. \let\appentry\numchapentry%
  1545. \let\appsecentry\numsecentry%
  1546. \let\appsubsecentry\numsubsecentry%
  1547. \let\appsubsubsecentry\numsubsubsecentry%
  1548. \let\unnchapentry\numchapentry%
  1549. \let\unnsecentry\numsecentry%
  1550. \let\unnsubsecentry\numsubsecentry%
  1551. \let\unnsubsubsecentry\numsubsubsecentry%
  1552. %
  1553. % For XeTeX, xdvipdfmx converts strings to UTF-16.
  1554. % Therefore, the encoding and the language may not be considered.
  1555. %
  1556. \indexnofonts
  1557. \setupdatafile
  1558. % We can have normal brace characters in the PDF outlines, unlike
  1559. % Texinfo index files. So set that up.
  1560. \def\{{\lbracecharliteral}%
  1561. \def\}{\rbracecharliteral}%
  1562. \catcode`\\=\active \otherbackslash
  1563. \input \tocreadfilename
  1564. \endgroup
  1565. }
  1566. {\catcode`[=1 \catcode`]=2
  1567. \catcode`{=\other \catcode`}=\other
  1568. \gdef\lbracecharliteral[{]%
  1569. \gdef\rbracecharliteral[}]%
  1570. ]
  1571. \special{pdf:docview << /PageMode /UseOutlines >> }
  1572. % ``\special{pdf:tounicode ...}'' is not necessary
  1573. % because xdvipdfmx converts strings from UTF-8 to UTF-16 without it.
  1574. % However, due to a UTF-16 conversion issue of xdvipdfmx 20150315,
  1575. % ``\special{pdf:dest ...}'' cannot handle non-ASCII strings.
  1576. % It is fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
  1577. %
  1578. \def\skipspaces#1{\def\PP{#1}\def\D{|}%
  1579. \ifx\PP\D\let\nextsp\relax
  1580. \else\let\nextsp\skipspaces
  1581. \addtokens{\filename}{\PP}%
  1582. \advance\filenamelength by 1
  1583. \fi
  1584. \nextsp}
  1585. \def\getfilename#1{%
  1586. \filenamelength=0
  1587. % If we don't expand the argument now, \skipspaces will get
  1588. % snagged on things like "@value{foo}".
  1589. \edef\temp{#1}%
  1590. \expandafter\skipspaces\temp|\relax
  1591. }
  1592. % make a live url in pdf output.
  1593. \def\pdfurl#1{%
  1594. \begingroup
  1595. % it seems we really need yet another set of dummies; have not
  1596. % tried to figure out what each command should do in the context
  1597. % of @url. for now, just make @/ a no-op, that's the only one
  1598. % people have actually reported a problem with.
  1599. %
  1600. \normalturnoffactive
  1601. \def\@{@}%
  1602. \let\/=\empty
  1603. \makevalueexpandable
  1604. % do we want to go so far as to use \indexnofonts instead of just
  1605. % special-casing \var here?
  1606. \def\var##1{##1}%
  1607. %
  1608. \leavevmode\setcolor{\urlcolor}%
  1609. \special{pdf:bann << /Border [0 0 0]
  1610. /Subtype /Link /A << /S /URI /URI (#1) >> >>}%
  1611. \endgroup}
  1612. \def\endlink{\setcolor{\maincolor}\special{pdf:eann}}
  1613. \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}}
  1614. \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks}
  1615. \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks}
  1616. \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}}
  1617. \def\maketoks{%
  1618. \expandafter\poptoks\the\toksA|ENDTOKS|\relax
  1619. \ifx\first0\adn0
  1620. \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3
  1621. \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6
  1622. \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9
  1623. \else
  1624. \ifnum0=\countA\else\makelink\fi
  1625. \ifx\first.\let\next=\done\else
  1626. \let\next=\maketoks
  1627. \addtokens{\toksB}{\the\toksD}
  1628. \ifx\first,\addtokens{\toksB}{\space}\fi
  1629. \fi
  1630. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  1631. \next}
  1632. \def\makelink{\addtokens{\toksB}%
  1633. {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
  1634. \def\pdflink#1{%
  1635. \special{pdf:bann << /Border [0 0 0]
  1636. /Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
  1637. \setcolor{\linkcolor}#1\endlink}
  1638. \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
  1639. %
  1640. %
  1641. % @image support
  1642. %
  1643. % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
  1644. \def\doxeteximage#1#2#3{%
  1645. \def\xeteximagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
  1646. \def\xeteximageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
  1647. %
  1648. % XeTeX (and the PDF format) supports .pdf, .png, .jpg (among
  1649. % others). Let's try in that order, PDF first since if
  1650. % someone has a scalable image, presumably better to use that than a
  1651. % bitmap.
  1652. \let\xeteximgext=\empty
  1653. \begingroup
  1654. \openin 1 #1.pdf \ifeof 1
  1655. \openin 1 #1.PDF \ifeof 1
  1656. \openin 1 #1.png \ifeof 1
  1657. \openin 1 #1.jpg \ifeof 1
  1658. \openin 1 #1.jpeg \ifeof 1
  1659. \openin 1 #1.JPG \ifeof 1
  1660. \errmessage{Could not find image file #1 for XeTeX}%
  1661. \else \gdef\xeteximgext{JPG}%
  1662. \fi
  1663. \else \gdef\xeteximgext{jpeg}%
  1664. \fi
  1665. \else \gdef\xeteximgext{jpg}%
  1666. \fi
  1667. \else \gdef\xeteximgext{png}%
  1668. \fi
  1669. \else \gdef\xeteximgext{PDF}%
  1670. \fi
  1671. \else \gdef\xeteximgext{pdf}%
  1672. \fi
  1673. \closein 1
  1674. \endgroup
  1675. %
  1676. \def\xetexpdfext{pdf}%
  1677. \ifx\xeteximgext\xetexpdfext
  1678. \XeTeXpdffile "#1".\xeteximgext ""
  1679. \else
  1680. \def\xetexpdfext{PDF}%
  1681. \ifx\xeteximgext\xetexpdfext
  1682. \XeTeXpdffile "#1".\xeteximgext ""
  1683. \else
  1684. \XeTeXpicfile "#1".\xeteximgext ""
  1685. \fi
  1686. \fi
  1687. \ifdim \wd0 >0pt width \xeteximagewidth \fi
  1688. \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
  1689. }
  1690. \fi
  1691. %
  1692. \message{fonts,}
  1693. % Set the baselineskip to #1, and the lineskip and strut size
  1694. % correspondingly. There is no deep meaning behind these magic numbers
  1695. % used as factors; they just match (closely enough) what Knuth defined.
  1696. %
  1697. \def\lineskipfactor{.08333}
  1698. \def\strutheightpercent{.70833}
  1699. \def\strutdepthpercent {.29167}
  1700. %
  1701. % can get a sort of poor man's double spacing by redefining this.
  1702. \def\baselinefactor{1}
  1703. %
  1704. \newdimen\textleading
  1705. \def\setleading#1{%
  1706. \dimen0 = #1\relax
  1707. \normalbaselineskip = \baselinefactor\dimen0
  1708. \normallineskip = \lineskipfactor\normalbaselineskip
  1709. \normalbaselines
  1710. \setbox\strutbox =\hbox{%
  1711. \vrule width0pt height\strutheightpercent\baselineskip
  1712. depth \strutdepthpercent \baselineskip
  1713. }%
  1714. }
  1715. % PDF CMaps. See also LaTeX's t1.cmap.
  1716. %
  1717. % do nothing with this by default.
  1718. \expandafter\let\csname cmapOT1\endcsname\gobble
  1719. \expandafter\let\csname cmapOT1IT\endcsname\gobble
  1720. \expandafter\let\csname cmapOT1TT\endcsname\gobble
  1721. % if we are producing pdf, and we have \pdffontattr, then define cmaps.
  1722. % (\pdffontattr was introduced many years ago, but people still run
  1723. % older pdftex's; it's easy to conditionalize, so we do.)
  1724. \ifpdf \ifx\pdffontattr\thisisundefined \else
  1725. \begingroup
  1726. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1727. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1728. %%DocumentNeededResources: ProcSet (CIDInit)
  1729. %%IncludeResource: ProcSet (CIDInit)
  1730. %%BeginResource: CMap (TeX-OT1-0)
  1731. %%Title: (TeX-OT1-0 TeX OT1 0)
  1732. %%Version: 1.000
  1733. %%EndComments
  1734. /CIDInit /ProcSet findresource begin
  1735. 12 dict begin
  1736. begincmap
  1737. /CIDSystemInfo
  1738. << /Registry (TeX)
  1739. /Ordering (OT1)
  1740. /Supplement 0
  1741. >> def
  1742. /CMapName /TeX-OT1-0 def
  1743. /CMapType 2 def
  1744. 1 begincodespacerange
  1745. <00> <7F>
  1746. endcodespacerange
  1747. 8 beginbfrange
  1748. <00> <01> <0393>
  1749. <09> <0A> <03A8>
  1750. <23> <26> <0023>
  1751. <28> <3B> <0028>
  1752. <3F> <5B> <003F>
  1753. <5D> <5E> <005D>
  1754. <61> <7A> <0061>
  1755. <7B> <7C> <2013>
  1756. endbfrange
  1757. 40 beginbfchar
  1758. <02> <0398>
  1759. <03> <039B>
  1760. <04> <039E>
  1761. <05> <03A0>
  1762. <06> <03A3>
  1763. <07> <03D2>
  1764. <08> <03A6>
  1765. <0B> <00660066>
  1766. <0C> <00660069>
  1767. <0D> <0066006C>
  1768. <0E> <006600660069>
  1769. <0F> <00660066006C>
  1770. <10> <0131>
  1771. <11> <0237>
  1772. <12> <0060>
  1773. <13> <00B4>
  1774. <14> <02C7>
  1775. <15> <02D8>
  1776. <16> <00AF>
  1777. <17> <02DA>
  1778. <18> <00B8>
  1779. <19> <00DF>
  1780. <1A> <00E6>
  1781. <1B> <0153>
  1782. <1C> <00F8>
  1783. <1D> <00C6>
  1784. <1E> <0152>
  1785. <1F> <00D8>
  1786. <21> <0021>
  1787. <22> <201D>
  1788. <27> <2019>
  1789. <3C> <00A1>
  1790. <3D> <003D>
  1791. <3E> <00BF>
  1792. <5C> <201C>
  1793. <5F> <02D9>
  1794. <60> <2018>
  1795. <7D> <02DD>
  1796. <7E> <007E>
  1797. <7F> <00A8>
  1798. endbfchar
  1799. endcmap
  1800. CMapName currentdict /CMap defineresource pop
  1801. end
  1802. end
  1803. %%EndResource
  1804. %%EOF
  1805. }\endgroup
  1806. \expandafter\edef\csname cmapOT1\endcsname#1{%
  1807. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  1808. }%
  1809. %
  1810. % \cmapOT1IT
  1811. \begingroup
  1812. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1813. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1814. %%DocumentNeededResources: ProcSet (CIDInit)
  1815. %%IncludeResource: ProcSet (CIDInit)
  1816. %%BeginResource: CMap (TeX-OT1IT-0)
  1817. %%Title: (TeX-OT1IT-0 TeX OT1IT 0)
  1818. %%Version: 1.000
  1819. %%EndComments
  1820. /CIDInit /ProcSet findresource begin
  1821. 12 dict begin
  1822. begincmap
  1823. /CIDSystemInfo
  1824. << /Registry (TeX)
  1825. /Ordering (OT1IT)
  1826. /Supplement 0
  1827. >> def
  1828. /CMapName /TeX-OT1IT-0 def
  1829. /CMapType 2 def
  1830. 1 begincodespacerange
  1831. <00> <7F>
  1832. endcodespacerange
  1833. 8 beginbfrange
  1834. <00> <01> <0393>
  1835. <09> <0A> <03A8>
  1836. <25> <26> <0025>
  1837. <28> <3B> <0028>
  1838. <3F> <5B> <003F>
  1839. <5D> <5E> <005D>
  1840. <61> <7A> <0061>
  1841. <7B> <7C> <2013>
  1842. endbfrange
  1843. 42 beginbfchar
  1844. <02> <0398>
  1845. <03> <039B>
  1846. <04> <039E>
  1847. <05> <03A0>
  1848. <06> <03A3>
  1849. <07> <03D2>
  1850. <08> <03A6>
  1851. <0B> <00660066>
  1852. <0C> <00660069>
  1853. <0D> <0066006C>
  1854. <0E> <006600660069>
  1855. <0F> <00660066006C>
  1856. <10> <0131>
  1857. <11> <0237>
  1858. <12> <0060>
  1859. <13> <00B4>
  1860. <14> <02C7>
  1861. <15> <02D8>
  1862. <16> <00AF>
  1863. <17> <02DA>
  1864. <18> <00B8>
  1865. <19> <00DF>
  1866. <1A> <00E6>
  1867. <1B> <0153>
  1868. <1C> <00F8>
  1869. <1D> <00C6>
  1870. <1E> <0152>
  1871. <1F> <00D8>
  1872. <21> <0021>
  1873. <22> <201D>
  1874. <23> <0023>
  1875. <24> <00A3>
  1876. <27> <2019>
  1877. <3C> <00A1>
  1878. <3D> <003D>
  1879. <3E> <00BF>
  1880. <5C> <201C>
  1881. <5F> <02D9>
  1882. <60> <2018>
  1883. <7D> <02DD>
  1884. <7E> <007E>
  1885. <7F> <00A8>
  1886. endbfchar
  1887. endcmap
  1888. CMapName currentdict /CMap defineresource pop
  1889. end
  1890. end
  1891. %%EndResource
  1892. %%EOF
  1893. }\endgroup
  1894. \expandafter\edef\csname cmapOT1IT\endcsname#1{%
  1895. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  1896. }%
  1897. %
  1898. % \cmapOT1TT
  1899. \begingroup
  1900. \catcode`\^^M=\active \def^^M{^^J}% Output line endings as the ^^J char.
  1901. \catcode`\%=12 \immediate\pdfobj stream {%!PS-Adobe-3.0 Resource-CMap
  1902. %%DocumentNeededResources: ProcSet (CIDInit)
  1903. %%IncludeResource: ProcSet (CIDInit)
  1904. %%BeginResource: CMap (TeX-OT1TT-0)
  1905. %%Title: (TeX-OT1TT-0 TeX OT1TT 0)
  1906. %%Version: 1.000
  1907. %%EndComments
  1908. /CIDInit /ProcSet findresource begin
  1909. 12 dict begin
  1910. begincmap
  1911. /CIDSystemInfo
  1912. << /Registry (TeX)
  1913. /Ordering (OT1TT)
  1914. /Supplement 0
  1915. >> def
  1916. /CMapName /TeX-OT1TT-0 def
  1917. /CMapType 2 def
  1918. 1 begincodespacerange
  1919. <00> <7F>
  1920. endcodespacerange
  1921. 5 beginbfrange
  1922. <00> <01> <0393>
  1923. <09> <0A> <03A8>
  1924. <21> <26> <0021>
  1925. <28> <5F> <0028>
  1926. <61> <7E> <0061>
  1927. endbfrange
  1928. 32 beginbfchar
  1929. <02> <0398>
  1930. <03> <039B>
  1931. <04> <039E>
  1932. <05> <03A0>
  1933. <06> <03A3>
  1934. <07> <03D2>
  1935. <08> <03A6>
  1936. <0B> <2191>
  1937. <0C> <2193>
  1938. <0D> <0027>
  1939. <0E> <00A1>
  1940. <0F> <00BF>
  1941. <10> <0131>
  1942. <11> <0237>
  1943. <12> <0060>
  1944. <13> <00B4>
  1945. <14> <02C7>
  1946. <15> <02D8>
  1947. <16> <00AF>
  1948. <17> <02DA>
  1949. <18> <00B8>
  1950. <19> <00DF>
  1951. <1A> <00E6>
  1952. <1B> <0153>
  1953. <1C> <00F8>
  1954. <1D> <00C6>
  1955. <1E> <0152>
  1956. <1F> <00D8>
  1957. <20> <2423>
  1958. <27> <2019>
  1959. <60> <2018>
  1960. <7F> <00A8>
  1961. endbfchar
  1962. endcmap
  1963. CMapName currentdict /CMap defineresource pop
  1964. end
  1965. end
  1966. %%EndResource
  1967. %%EOF
  1968. }\endgroup
  1969. \expandafter\edef\csname cmapOT1TT\endcsname#1{%
  1970. \pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
  1971. }%
  1972. \fi\fi
  1973. % Set the font macro #1 to the font named \fontprefix#2.
  1974. % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
  1975. % encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
  1976. % Example:
  1977. % #1 = \textrm
  1978. % #2 = \rmshape
  1979. % #3 = 10
  1980. % #4 = \mainmagstep
  1981. % #5 = OT1
  1982. %
  1983. \def\setfont#1#2#3#4#5{%
  1984. \font#1=\fontprefix#2#3 scaled #4
  1985. \csname cmap#5\endcsname#1%
  1986. }
  1987. % This is what gets called when #5 of \setfont is empty.
  1988. \let\cmap\gobble
  1989. %
  1990. % (end of cmaps)
  1991. % Use cm as the default font prefix.
  1992. % To specify the font prefix, you must define \fontprefix
  1993. % before you read in texinfo.tex.
  1994. \ifx\fontprefix\thisisundefined
  1995. \def\fontprefix{cm}
  1996. \fi
  1997. % Support font families that don't use the same naming scheme as CM.
  1998. \def\rmshape{r}
  1999. \def\rmbshape{bx} % where the normal face is bold
  2000. \def\bfshape{b}
  2001. \def\bxshape{bx}
  2002. \def\ttshape{tt}
  2003. \def\ttbshape{tt}
  2004. \def\ttslshape{sltt}
  2005. \def\itshape{ti}
  2006. \def\itbshape{bxti}
  2007. \def\slshape{sl}
  2008. \def\slbshape{bxsl}
  2009. \def\sfshape{ss}
  2010. \def\sfbshape{ss}
  2011. \def\scshape{csc}
  2012. \def\scbshape{csc}
  2013. % Definitions for a main text size of 11pt. (The default in Texinfo.)
  2014. %
  2015. \def\definetextfontsizexi{%
  2016. % Text fonts (11.2pt, magstep1).
  2017. \def\textnominalsize{11pt}
  2018. \edef\mainmagstep{\magstephalf}
  2019. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2020. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2021. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2022. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2023. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2024. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2025. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2026. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2027. \font\texti=cmmi10 scaled \mainmagstep
  2028. \font\textsy=cmsy10 scaled \mainmagstep
  2029. \def\textecsize{1095}
  2030. % A few fonts for @defun names and args.
  2031. \setfont\defbf\bfshape{10}{\magstep1}{OT1}
  2032. \setfont\deftt\ttshape{10}{\magstep1}{OT1TT}
  2033. \setfont\defsl\slshape{10}{\magstep1}{OT1TT}
  2034. \setfont\defttsl\ttslshape{10}{\magstep1}{OT1TT}
  2035. \def\df{\let\ttfont=\deftt \let\bffont = \defbf
  2036. \let\ttslfont=\defttsl \let\slfont=\defsl \bf}
  2037. % Fonts for indices, footnotes, small examples (9pt).
  2038. \def\smallnominalsize{9pt}
  2039. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2040. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2041. \setfont\smallbf\bfshape{10}{900}{OT1}
  2042. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2043. \setfont\smallsl\slshape{9}{1000}{OT1}
  2044. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2045. \setfont\smallsc\scshape{10}{900}{OT1}
  2046. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2047. \font\smalli=cmmi9
  2048. \font\smallsy=cmsy9
  2049. \def\smallecsize{0900}
  2050. % Fonts for small examples (8pt).
  2051. \def\smallernominalsize{8pt}
  2052. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2053. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2054. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2055. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2056. \setfont\smallersl\slshape{8}{1000}{OT1}
  2057. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2058. \setfont\smallersc\scshape{10}{800}{OT1}
  2059. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2060. \font\smalleri=cmmi8
  2061. \font\smallersy=cmsy8
  2062. \def\smallerecsize{0800}
  2063. % Fonts for math mode superscripts (7pt).
  2064. \def\sevennominalsize{7pt}
  2065. \setfont\sevenrm\rmshape{7}{1000}{OT1}
  2066. \setfont\seventt\ttshape{10}{700}{OT1TT}
  2067. \setfont\sevenbf\bfshape{10}{700}{OT1}
  2068. \setfont\sevenit\itshape{7}{1000}{OT1IT}
  2069. \setfont\sevensl\slshape{10}{700}{OT1}
  2070. \setfont\sevensf\sfshape{10}{700}{OT1}
  2071. \setfont\sevensc\scshape{10}{700}{OT1}
  2072. \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
  2073. \font\seveni=cmmi7
  2074. \font\sevensy=cmsy7
  2075. \def\sevenecsize{0700}
  2076. % Fonts for title page (20.4pt):
  2077. \def\titlenominalsize{20pt}
  2078. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2079. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2080. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2081. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2082. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2083. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2084. \let\titlebf=\titlerm
  2085. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2086. \font\titlei=cmmi12 scaled \magstep3
  2087. \font\titlesy=cmsy10 scaled \magstep4
  2088. \def\titleecsize{2074}
  2089. % Chapter (and unnumbered) fonts (17.28pt).
  2090. \def\chapnominalsize{17pt}
  2091. \setfont\chaprm\rmbshape{12}{\magstep2}{OT1}
  2092. \setfont\chapit\itbshape{10}{\magstep3}{OT1IT}
  2093. \setfont\chapsl\slbshape{10}{\magstep3}{OT1}
  2094. \setfont\chaptt\ttbshape{12}{\magstep2}{OT1TT}
  2095. \setfont\chapttsl\ttslshape{10}{\magstep3}{OT1TT}
  2096. \setfont\chapsf\sfbshape{17}{1000}{OT1}
  2097. \let\chapbf=\chaprm
  2098. \setfont\chapsc\scbshape{10}{\magstep3}{OT1}
  2099. \font\chapi=cmmi12 scaled \magstep2
  2100. \font\chapsy=cmsy10 scaled \magstep3
  2101. \def\chapecsize{1728}
  2102. % Section fonts (14.4pt).
  2103. \def\secnominalsize{14pt}
  2104. \setfont\secrm\rmbshape{12}{\magstep1}{OT1}
  2105. \setfont\secrmnotbold\rmshape{12}{\magstep1}{OT1}
  2106. \setfont\secit\itbshape{10}{\magstep2}{OT1IT}
  2107. \setfont\secsl\slbshape{10}{\magstep2}{OT1}
  2108. \setfont\sectt\ttbshape{12}{\magstep1}{OT1TT}
  2109. \setfont\secttsl\ttslshape{10}{\magstep2}{OT1TT}
  2110. \setfont\secsf\sfbshape{12}{\magstep1}{OT1}
  2111. \let\secbf\secrm
  2112. \setfont\secsc\scbshape{10}{\magstep2}{OT1}
  2113. \font\seci=cmmi12 scaled \magstep1
  2114. \font\secsy=cmsy10 scaled \magstep2
  2115. \def\sececsize{1440}
  2116. % Subsection fonts (13.15pt).
  2117. \def\ssecnominalsize{13pt}
  2118. \setfont\ssecrm\rmbshape{12}{\magstephalf}{OT1}
  2119. \setfont\ssecit\itbshape{10}{1315}{OT1IT}
  2120. \setfont\ssecsl\slbshape{10}{1315}{OT1}
  2121. \setfont\ssectt\ttbshape{12}{\magstephalf}{OT1TT}
  2122. \setfont\ssecttsl\ttslshape{10}{1315}{OT1TT}
  2123. \setfont\ssecsf\sfbshape{12}{\magstephalf}{OT1}
  2124. \let\ssecbf\ssecrm
  2125. \setfont\ssecsc\scbshape{10}{1315}{OT1}
  2126. \font\sseci=cmmi12 scaled \magstephalf
  2127. \font\ssecsy=cmsy10 scaled 1315
  2128. \def\ssececsize{1200}
  2129. % Reduced fonts for @acronym in text (10pt).
  2130. \def\reducednominalsize{10pt}
  2131. \setfont\reducedrm\rmshape{10}{1000}{OT1}
  2132. \setfont\reducedtt\ttshape{10}{1000}{OT1TT}
  2133. \setfont\reducedbf\bfshape{10}{1000}{OT1}
  2134. \setfont\reducedit\itshape{10}{1000}{OT1IT}
  2135. \setfont\reducedsl\slshape{10}{1000}{OT1}
  2136. \setfont\reducedsf\sfshape{10}{1000}{OT1}
  2137. \setfont\reducedsc\scshape{10}{1000}{OT1}
  2138. \setfont\reducedttsl\ttslshape{10}{1000}{OT1TT}
  2139. \font\reducedi=cmmi10
  2140. \font\reducedsy=cmsy10
  2141. \def\reducedecsize{1000}
  2142. \textleading = 13.2pt % line spacing for 11pt CM
  2143. \textfonts % reset the current fonts
  2144. \rm
  2145. } % end of 11pt text font size definitions, \definetextfontsizexi
  2146. % Definitions to make the main text be 10pt Computer Modern, with
  2147. % section, chapter, etc., sizes following suit. This is for the GNU
  2148. % Press printing of the Emacs 22 manual. Maybe other manuals in the
  2149. % future. Used with @smallbook, which sets the leading to 12pt.
  2150. %
  2151. \def\definetextfontsizex{%
  2152. % Text fonts (10pt).
  2153. \def\textnominalsize{10pt}
  2154. \edef\mainmagstep{1000}
  2155. \setfont\textrm\rmshape{10}{\mainmagstep}{OT1}
  2156. \setfont\texttt\ttshape{10}{\mainmagstep}{OT1TT}
  2157. \setfont\textbf\bfshape{10}{\mainmagstep}{OT1}
  2158. \setfont\textit\itshape{10}{\mainmagstep}{OT1IT}
  2159. \setfont\textsl\slshape{10}{\mainmagstep}{OT1}
  2160. \setfont\textsf\sfshape{10}{\mainmagstep}{OT1}
  2161. \setfont\textsc\scshape{10}{\mainmagstep}{OT1}
  2162. \setfont\textttsl\ttslshape{10}{\mainmagstep}{OT1TT}
  2163. \font\texti=cmmi10 scaled \mainmagstep
  2164. \font\textsy=cmsy10 scaled \mainmagstep
  2165. \def\textecsize{1000}
  2166. % A few fonts for @defun names and args.
  2167. \setfont\defbf\bfshape{10}{\magstephalf}{OT1}
  2168. \setfont\deftt\ttshape{10}{\magstephalf}{OT1TT}
  2169. \setfont\defsl\slshape{10}{\magstephalf}{OT1TT}
  2170. \setfont\defttsl\ttslshape{10}{\magstephalf}{OT1TT}
  2171. \def\df{\let\ttfont=\deftt \let\bffont = \defbf
  2172. \let\slfont=\defsl \let\ttslfont=\defttsl \bf}
  2173. % Fonts for indices, footnotes, small examples (9pt).
  2174. \def\smallnominalsize{9pt}
  2175. \setfont\smallrm\rmshape{9}{1000}{OT1}
  2176. \setfont\smalltt\ttshape{9}{1000}{OT1TT}
  2177. \setfont\smallbf\bfshape{10}{900}{OT1}
  2178. \setfont\smallit\itshape{9}{1000}{OT1IT}
  2179. \setfont\smallsl\slshape{9}{1000}{OT1}
  2180. \setfont\smallsf\sfshape{9}{1000}{OT1}
  2181. \setfont\smallsc\scshape{10}{900}{OT1}
  2182. \setfont\smallttsl\ttslshape{10}{900}{OT1TT}
  2183. \font\smalli=cmmi9
  2184. \font\smallsy=cmsy9
  2185. \def\smallecsize{0900}
  2186. % Fonts for small examples (8pt).
  2187. \def\smallernominalsize{8pt}
  2188. \setfont\smallerrm\rmshape{8}{1000}{OT1}
  2189. \setfont\smallertt\ttshape{8}{1000}{OT1TT}
  2190. \setfont\smallerbf\bfshape{10}{800}{OT1}
  2191. \setfont\smallerit\itshape{8}{1000}{OT1IT}
  2192. \setfont\smallersl\slshape{8}{1000}{OT1}
  2193. \setfont\smallersf\sfshape{8}{1000}{OT1}
  2194. \setfont\smallersc\scshape{10}{800}{OT1}
  2195. \setfont\smallerttsl\ttslshape{10}{800}{OT1TT}
  2196. \font\smalleri=cmmi8
  2197. \font\smallersy=cmsy8
  2198. \def\smallerecsize{0800}
  2199. % Fonts for math mode superscripts (7pt).
  2200. \def\sevennominalsize{7pt}
  2201. \setfont\sevenrm\rmshape{7}{1000}{OT1}
  2202. \setfont\seventt\ttshape{10}{700}{OT1TT}
  2203. \setfont\sevenbf\bfshape{10}{700}{OT1}
  2204. \setfont\sevenit\itshape{7}{1000}{OT1IT}
  2205. \setfont\sevensl\slshape{10}{700}{OT1}
  2206. \setfont\sevensf\sfshape{10}{700}{OT1}
  2207. \setfont\sevensc\scshape{10}{700}{OT1}
  2208. \setfont\seventtsl\ttslshape{10}{700}{OT1TT}
  2209. \font\seveni=cmmi7
  2210. \font\sevensy=cmsy7
  2211. \def\sevenecsize{0700}
  2212. % Fonts for title page (20.4pt):
  2213. \def\titlenominalsize{20pt}
  2214. \setfont\titlerm\rmbshape{12}{\magstep3}{OT1}
  2215. \setfont\titleit\itbshape{10}{\magstep4}{OT1IT}
  2216. \setfont\titlesl\slbshape{10}{\magstep4}{OT1}
  2217. \setfont\titlett\ttbshape{12}{\magstep3}{OT1TT}
  2218. \setfont\titlettsl\ttslshape{10}{\magstep4}{OT1TT}
  2219. \setfont\titlesf\sfbshape{17}{\magstep1}{OT1}
  2220. \let\titlebf=\titlerm
  2221. \setfont\titlesc\scbshape{10}{\magstep4}{OT1}
  2222. \font\titlei=cmmi12 scaled \magstep3
  2223. \font\titlesy=cmsy10 scaled \magstep4
  2224. \def\titleecsize{2074}
  2225. % Chapter fonts (14.4pt).
  2226. \def\chapnominalsize{14pt}
  2227. \setfont\chaprm\rmbshape{12}{\magstep1}{OT1}
  2228. \setfont\chapit\itbshape{10}{\magstep2}{OT1IT}
  2229. \setfont\chapsl\slbshape{10}{\magstep2}{OT1}
  2230. \setfont\chaptt\ttbshape{12}{\magstep1}{OT1TT}
  2231. \setfont\chapttsl\ttslshape{10}{\magstep2}{OT1TT}
  2232. \setfont\chapsf\sfbshape{12}{\magstep1}{OT1}
  2233. \let\chapbf\chaprm
  2234. \setfont\chapsc\scbshape{10}{\magstep2}{OT1}
  2235. \font\chapi=cmmi12 scaled \magstep1
  2236. \font\chapsy=cmsy10 scaled \magstep2
  2237. \def\chapecsize{1440}
  2238. % Section fonts (12pt).
  2239. \def\secnominalsize{12pt}
  2240. \setfont\secrm\rmbshape{12}{1000}{OT1}
  2241. \setfont\secit\itbshape{10}{\magstep1}{OT1IT}
  2242. \setfont\secsl\slbshape{10}{\magstep1}{OT1}
  2243. \setfont\sectt\ttbshape{12}{1000}{OT1TT}
  2244. \setfont\secttsl\ttslshape{10}{\magstep1}{OT1TT}
  2245. \setfont\secsf\sfbshape{12}{1000}{OT1}
  2246. \let\secbf\secrm
  2247. \setfont\secsc\scbshape{10}{\magstep1}{OT1}
  2248. \font\seci=cmmi12
  2249. \font\secsy=cmsy10 scaled \magstep1
  2250. \def\sececsize{1200}
  2251. % Subsection fonts (10pt).
  2252. \def\ssecnominalsize{10pt}
  2253. \setfont\ssecrm\rmbshape{10}{1000}{OT1}
  2254. \setfont\ssecit\itbshape{10}{1000}{OT1IT}
  2255. \setfont\ssecsl\slbshape{10}{1000}{OT1}
  2256. \setfont\ssectt\ttbshape{10}{1000}{OT1TT}
  2257. \setfont\ssecttsl\ttslshape{10}{1000}{OT1TT}
  2258. \setfont\ssecsf\sfbshape{10}{1000}{OT1}
  2259. \let\ssecbf\ssecrm
  2260. \setfont\ssecsc\scbshape{10}{1000}{OT1}
  2261. \font\sseci=cmmi10
  2262. \font\ssecsy=cmsy10
  2263. \def\ssececsize{1000}
  2264. % Reduced fonts for @acronym in text (9pt).
  2265. \def\reducednominalsize{9pt}
  2266. \setfont\reducedrm\rmshape{9}{1000}{OT1}
  2267. \setfont\reducedtt\ttshape{9}{1000}{OT1TT}
  2268. \setfont\reducedbf\bfshape{10}{900}{OT1}
  2269. \setfont\reducedit\itshape{9}{1000}{OT1IT}
  2270. \setfont\reducedsl\slshape{9}{1000}{OT1}
  2271. \setfont\reducedsf\sfshape{9}{1000}{OT1}
  2272. \setfont\reducedsc\scshape{10}{900}{OT1}
  2273. \setfont\reducedttsl\ttslshape{10}{900}{OT1TT}
  2274. \font\reducedi=cmmi9
  2275. \font\reducedsy=cmsy9
  2276. \def\reducedecsize{0900}
  2277. \divide\parskip by 2 % reduce space between paragraphs
  2278. \textleading = 12pt % line spacing for 10pt CM
  2279. \textfonts % reset the current fonts
  2280. \rm
  2281. } % end of 10pt text font size definitions, \definetextfontsizex
  2282. % Fonts for short table of contents.
  2283. \setfont\shortcontrm\rmshape{12}{1000}{OT1}
  2284. \setfont\shortcontbf\bfshape{10}{\magstep1}{OT1} % no cmb12
  2285. \setfont\shortcontsl\slshape{12}{1000}{OT1}
  2286. \setfont\shortconttt\ttshape{12}{1000}{OT1TT}
  2287. % We provide the user-level command
  2288. % @fonttextsize 10
  2289. % (or 11) to redefine the text font size. pt is assumed.
  2290. %
  2291. \def\xiword{11}
  2292. \def\xword{10}
  2293. \def\xwordpt{10pt}
  2294. %
  2295. \parseargdef\fonttextsize{%
  2296. \def\textsizearg{#1}%
  2297. %\wlog{doing @fonttextsize \textsizearg}%
  2298. %
  2299. % Set \globaldefs so that documents can use this inside @tex, since
  2300. % makeinfo 4.8 does not support it, but we need it nonetheless.
  2301. %
  2302. \begingroup \globaldefs=1
  2303. \ifx\textsizearg\xword \definetextfontsizex
  2304. \else \ifx\textsizearg\xiword \definetextfontsizexi
  2305. \else
  2306. \errhelp=\EMsimple
  2307. \errmessage{@fonttextsize only supports `10' or `11', not `\textsizearg'}
  2308. \fi\fi
  2309. \endgroup
  2310. }
  2311. %
  2312. % Change the current font style to #1, remembering it in \curfontstyle.
  2313. % For now, we do not accumulate font styles: @b{@i{foo}} prints foo in
  2314. % italics, not bold italics.
  2315. %
  2316. \def\setfontstyle#1{%
  2317. \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd.
  2318. \csname #1font\endcsname % change the current font
  2319. }
  2320. \def\rm{\fam=0 \setfontstyle{rm}}
  2321. \def\it{\fam=\itfam \setfontstyle{it}}
  2322. \def\sl{\fam=\slfam \setfontstyle{sl}}
  2323. \def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf}
  2324. \def\tt{\fam=\ttfam \setfontstyle{tt}}
  2325. % Texinfo sort of supports the sans serif font style, which plain TeX does not.
  2326. % So we set up a \sf.
  2327. \newfam\sffam
  2328. \def\sf{\fam=\sffam \setfontstyle{sf}}
  2329. % We don't need math for this font style.
  2330. \def\ttsl{\setfontstyle{ttsl}}
  2331. % In order for the font changes to affect most math symbols and letters,
  2332. % we have to define the \textfont of the standard families.
  2333. % We don't bother to reset \scriptscriptfont; awaiting user need.
  2334. %
  2335. \def\resetmathfonts{%
  2336. \textfont0=\rmfont \textfont1=\ifont \textfont2=\syfont
  2337. \textfont\itfam=\itfont \textfont\slfam=\slfont \textfont\bffam=\bffont
  2338. \textfont\ttfam=\ttfont \textfont\sffam=\sffont
  2339. %
  2340. % Fonts for superscript. Note that the 7pt fonts are used regardless
  2341. % of the current font size.
  2342. \scriptfont0=\sevenrm \scriptfont1=\seveni \scriptfont2=\sevensy
  2343. \scriptfont\itfam=\sevenit \scriptfont\slfam=\sevensl
  2344. \scriptfont\bffam=\sevenbf \scriptfont\ttfam=\seventt
  2345. \scriptfont\sffam=\sevensf
  2346. }
  2347. %
  2348. % The font-changing commands (all called \...fonts) redefine the meanings
  2349. % of \STYLEfont, instead of just \STYLE. We do this because \STYLE needs
  2350. % to also set the current \fam for math mode. Our \STYLE (e.g., \rm)
  2351. % commands hardwire \STYLEfont to set the current font.
  2352. %
  2353. % The fonts used for \ifont are for "math italics" (\itfont is for italics
  2354. % in regular text). \syfont is also used in math mode only.
  2355. %
  2356. % Each font-changing command also sets the names \lsize (one size lower)
  2357. % and \lllsize (three sizes lower). These relative commands are used
  2358. % in, e.g., the LaTeX logo and acronyms.
  2359. %
  2360. % This all needs generalizing, badly.
  2361. %
  2362. \def\assignfonts#1{%
  2363. \expandafter\let\expandafter\rmfont\csname #1rm\endcsname
  2364. \expandafter\let\expandafter\itfont\csname #1it\endcsname
  2365. \expandafter\let\expandafter\slfont\csname #1sl\endcsname
  2366. \expandafter\let\expandafter\bffont\csname #1bf\endcsname
  2367. \expandafter\let\expandafter\ttfont\csname #1tt\endcsname
  2368. \expandafter\let\expandafter\smallcaps\csname #1sc\endcsname
  2369. \expandafter\let\expandafter\sffont \csname #1sf\endcsname
  2370. \expandafter\let\expandafter\ifont \csname #1i\endcsname
  2371. \expandafter\let\expandafter\syfont \csname #1sy\endcsname
  2372. \expandafter\let\expandafter\ttslfont\csname #1ttsl\endcsname
  2373. }
  2374. \newif\ifrmisbold
  2375. % Select smaller font size with the current style. Used to change font size
  2376. % in, e.g., the LaTeX logo and acronyms. If we are using bold fonts for
  2377. % normal roman text, also use bold fonts for roman text in the smaller size.
  2378. \def\switchtolllsize{%
  2379. \expandafter\assignfonts\expandafter{\lllsize}%
  2380. \ifrmisbold
  2381. \let\rmfont\bffont
  2382. \fi
  2383. \csname\curfontstyle\endcsname
  2384. }%
  2385. \def\switchtolsize{%
  2386. \expandafter\assignfonts\expandafter{\lsize}%
  2387. \ifrmisbold
  2388. \let\rmfont\bffont
  2389. \fi
  2390. \csname\curfontstyle\endcsname
  2391. }%
  2392. \def\definefontsetatsize#1#2#3#4#5{%
  2393. \expandafter\def\csname #1fonts\endcsname{%
  2394. \def\curfontsize{#1}%
  2395. \def\lsize{#2}\def\lllsize{#3}%
  2396. \csname rmisbold#5\endcsname
  2397. \assignfonts{#1}%
  2398. \resetmathfonts
  2399. \setleading{#4}%
  2400. }}
  2401. \definefontsetatsize{text} {reduced}{smaller}{\textleading}{false}
  2402. \definefontsetatsize{title} {chap} {subsec} {27pt} {true}
  2403. \definefontsetatsize{chap} {sec} {text} {19pt} {true}
  2404. \definefontsetatsize{sec} {subsec} {reduced}{17pt} {true}
  2405. \definefontsetatsize{ssec} {text} {small} {15pt} {true}
  2406. \definefontsetatsize{reduced}{small} {smaller}{10.5pt}{false}
  2407. \definefontsetatsize{small} {smaller}{smaller}{10.5pt}{false}
  2408. \definefontsetatsize{smaller}{smaller}{smaller}{9.5pt} {false}
  2409. \def\titlefont#1{{\titlefonts\rm #1}}
  2410. \let\subsecfonts = \ssecfonts
  2411. \let\subsubsecfonts = \ssecfonts
  2412. % Define these just so they can be easily changed for other fonts.
  2413. \def\angleleft{$\langle$}
  2414. \def\angleright{$\rangle$}
  2415. % Set the fonts to use with the @small... environments.
  2416. \let\smallexamplefonts = \smallfonts
  2417. % About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample
  2418. % can fit this many characters:
  2419. % 8.5x11=86 smallbook=72 a4=90 a5=69
  2420. % If we use \scriptfonts (8pt), then we can fit this many characters:
  2421. % 8.5x11=90+ smallbook=80 a4=90+ a5=77
  2422. % For me, subjectively, the few extra characters that fit aren't worth
  2423. % the additional smallness of 8pt. So I'm making the default 9pt.
  2424. %
  2425. % By the way, for comparison, here's what fits with @example (10pt):
  2426. % 8.5x11=71 smallbook=60 a4=75 a5=58
  2427. % --karl, 24jan03.
  2428. % Set up the default fonts, so we can use them for creating boxes.
  2429. %
  2430. \definetextfontsizexi
  2431. \message{markup,}
  2432. % Check if we are currently using a typewriter font. Since all the
  2433. % Computer Modern typewriter fonts have zero interword stretch (and
  2434. % shrink), and it is reasonable to expect all typewriter fonts to have
  2435. % this property, we can check that font parameter.
  2436. %
  2437. \def\ifmonospace{\ifdim\fontdimen3\font=0pt }
  2438. % Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
  2439. % define and register \INITMACRO to be called on markup style changes.
  2440. % \INITMACRO can check \currentmarkupstyle for the innermost
  2441. % style.
  2442. \let\currentmarkupstyle\empty
  2443. \def\setupmarkupstyle#1{%
  2444. \def\currentmarkupstyle{#1}%
  2445. \markupstylesetup
  2446. }
  2447. \let\markupstylesetup\empty
  2448. \def\defmarkupstylesetup#1{%
  2449. \expandafter\def\expandafter\markupstylesetup
  2450. \expandafter{\markupstylesetup #1}%
  2451. \def#1%
  2452. }
  2453. % Markup style setup for left and right quotes.
  2454. \defmarkupstylesetup\markupsetuplq{%
  2455. \expandafter\let\expandafter \temp
  2456. \csname markupsetuplq\currentmarkupstyle\endcsname
  2457. \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
  2458. }
  2459. \defmarkupstylesetup\markupsetuprq{%
  2460. \expandafter\let\expandafter \temp
  2461. \csname markupsetuprq\currentmarkupstyle\endcsname
  2462. \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
  2463. }
  2464. {
  2465. \catcode`\'=\active
  2466. \catcode`\`=\active
  2467. \gdef\markupsetuplqdefault{\let`\lq}
  2468. \gdef\markupsetuprqdefault{\let'\rq}
  2469. \gdef\markupsetcodequoteleft{\let`\codequoteleft}
  2470. \gdef\markupsetcodequoteright{\let'\codequoteright}
  2471. }
  2472. \let\markupsetuplqcode \markupsetcodequoteleft
  2473. \let\markupsetuprqcode \markupsetcodequoteright
  2474. %
  2475. \let\markupsetuplqexample \markupsetcodequoteleft
  2476. \let\markupsetuprqexample \markupsetcodequoteright
  2477. %
  2478. \let\markupsetuplqkbd \markupsetcodequoteleft
  2479. \let\markupsetuprqkbd \markupsetcodequoteright
  2480. %
  2481. \let\markupsetuplqsamp \markupsetcodequoteleft
  2482. \let\markupsetuprqsamp \markupsetcodequoteright
  2483. %
  2484. \let\markupsetuplqverb \markupsetcodequoteleft
  2485. \let\markupsetuprqverb \markupsetcodequoteright
  2486. %
  2487. \let\markupsetuplqverbatim \markupsetcodequoteleft
  2488. \let\markupsetuprqverbatim \markupsetcodequoteright
  2489. % Allow an option to not use regular directed right quote/apostrophe
  2490. % (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
  2491. % The undirected quote is ugly, so don't make it the default, but it
  2492. % works for pasting with more pdf viewers (at least evince), the
  2493. % lilypond developers report. xpdf does work with the regular 0x27.
  2494. %
  2495. \def\codequoteright{%
  2496. \ifmonospace
  2497. \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax
  2498. \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax
  2499. '%
  2500. \else \char'15 \fi
  2501. \else \char'15 \fi
  2502. \else
  2503. '%
  2504. \fi
  2505. }
  2506. %
  2507. % and a similar option for the left quote char vs. a grave accent.
  2508. % Modern fonts display ASCII 0x60 as a grave accent, so some people like
  2509. % the code environments to do likewise.
  2510. %
  2511. \def\codequoteleft{%
  2512. \ifmonospace
  2513. \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax
  2514. \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax
  2515. % [Knuth] pp. 380,381,391
  2516. % \relax disables Spanish ligatures ?` and !` of \tt font.
  2517. \relax`%
  2518. \else \char'22 \fi
  2519. \else \char'22 \fi
  2520. \else
  2521. \relax`%
  2522. \fi
  2523. }
  2524. % Commands to set the quote options.
  2525. %
  2526. \parseargdef\codequoteundirected{%
  2527. \def\temp{#1}%
  2528. \ifx\temp\onword
  2529. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2530. = t%
  2531. \else\ifx\temp\offword
  2532. \expandafter\let\csname SETtxicodequoteundirected\endcsname
  2533. = \relax
  2534. \else
  2535. \errhelp = \EMsimple
  2536. \errmessage{Unknown @codequoteundirected value `\temp', must be on|off}%
  2537. \fi\fi
  2538. }
  2539. %
  2540. \parseargdef\codequotebacktick{%
  2541. \def\temp{#1}%
  2542. \ifx\temp\onword
  2543. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2544. = t%
  2545. \else\ifx\temp\offword
  2546. \expandafter\let\csname SETtxicodequotebacktick\endcsname
  2547. = \relax
  2548. \else
  2549. \errhelp = \EMsimple
  2550. \errmessage{Unknown @codequotebacktick value `\temp', must be on|off}%
  2551. \fi\fi
  2552. }
  2553. % [Knuth] pp. 380,381,391, disable Spanish ligatures ?` and !` of \tt font.
  2554. \def\noligaturesquoteleft{\relax\lq}
  2555. % Count depth in font-changes, for error checks
  2556. \newcount\fontdepth \fontdepth=0
  2557. % Font commands.
  2558. % #1 is the font command (\sl or \it), #2 is the text to slant.
  2559. % If we are in a monospaced environment, however, 1) always use \ttsl,
  2560. % and 2) do not add an italic correction.
  2561. \def\dosmartslant#1#2{%
  2562. \ifusingtt
  2563. {{\ttsl #2}\let\next=\relax}%
  2564. {\def\next{{#1#2}\futurelet\next\smartitaliccorrection}}%
  2565. \next
  2566. }
  2567. \def\smartslanted{\dosmartslant\sl}
  2568. \def\smartitalic{\dosmartslant\it}
  2569. % Output an italic correction unless \next (presumed to be the following
  2570. % character) is such as not to need one.
  2571. \def\smartitaliccorrection{%
  2572. \ifx\next,%
  2573. \else\ifx\next-%
  2574. \else\ifx\next.%
  2575. \else\ifx\next\.%
  2576. \else\ifx\next\comma%
  2577. \else\ptexslash
  2578. \fi\fi\fi\fi\fi
  2579. \aftersmartic
  2580. }
  2581. % Unconditional use \ttsl, and no ic. @var is set to this for defuns.
  2582. \def\ttslanted#1{{\ttsl #1}}
  2583. % @cite is like \smartslanted except unconditionally use \sl. We never want
  2584. % ttsl for book titles, do we?
  2585. \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
  2586. \def\aftersmartic{}
  2587. \def\var#1{%
  2588. \let\saveaftersmartic = \aftersmartic
  2589. \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
  2590. \smartslanted{#1}%
  2591. }
  2592. \let\i=\smartitalic
  2593. \let\slanted=\smartslanted
  2594. \let\dfn=\smartslanted
  2595. \let\emph=\smartitalic
  2596. % Explicit font changes: @r, @sc, undocumented @ii.
  2597. \def\r#1{{\rm #1}} % roman font
  2598. \def\sc#1{{\smallcaps#1}} % smallcaps font
  2599. \def\ii#1{{\it #1}} % italic font
  2600. % @b, explicit bold. Also @strong.
  2601. \def\b#1{{\bf #1}}
  2602. \let\strong=\b
  2603. % @sansserif, explicit sans.
  2604. \def\sansserif#1{{\sf #1}}
  2605. % We can't just use \exhyphenpenalty, because that only has effect at
  2606. % the end of a paragraph. Restore normal hyphenation at the end of the
  2607. % group within which \nohyphenation is presumably called.
  2608. %
  2609. \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
  2610. \def\restorehyphenation{\hyphenchar\font = `- }
  2611. % Set sfcode to normal for the chars that usually have another value.
  2612. % Can't use plain's \frenchspacing because it uses the `\x notation, and
  2613. % sometimes \x has an active definition that messes things up.
  2614. %
  2615. \catcode`@=11
  2616. \def\plainfrenchspacing{%
  2617. \sfcode`\.=\@m \sfcode`\?=\@m \sfcode`\!=\@m
  2618. \sfcode`\:=\@m \sfcode`\;=\@m \sfcode`\,=\@m
  2619. \def\endofsentencespacefactor{1000}% for @. and friends
  2620. }
  2621. \def\plainnonfrenchspacing{%
  2622. \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000
  2623. \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250
  2624. \def\endofsentencespacefactor{3000}% for @. and friends
  2625. }
  2626. \catcode`@=\other
  2627. \def\endofsentencespacefactor{3000}% default
  2628. % @t, explicit typewriter.
  2629. \def\t#1{%
  2630. {\tt \rawbackslash \plainfrenchspacing #1}%
  2631. \null
  2632. }
  2633. % @samp.
  2634. \def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
  2635. % @indicateurl is \samp, that is, with quotes.
  2636. \let\indicateurl=\samp
  2637. % @code (and similar) prints in typewriter, but with spaces the same
  2638. % size as normal in the surrounding text, without hyphenation, etc.
  2639. % This is a subroutine for that.
  2640. \def\tclose#1{%
  2641. {%
  2642. % Change normal interword space to be same as for the current font.
  2643. \spaceskip = \fontdimen2\font
  2644. %
  2645. % Switch to typewriter.
  2646. \tt
  2647. %
  2648. % But `\ ' produces the large typewriter interword space.
  2649. \def\ {{\spaceskip = 0pt{} }}%
  2650. %
  2651. % Turn off hyphenation.
  2652. \nohyphenation
  2653. %
  2654. \rawbackslash
  2655. \plainfrenchspacing
  2656. #1%
  2657. }%
  2658. \null % reset spacefactor to 1000
  2659. }
  2660. % We *must* turn on hyphenation at `-' and `_' in @code.
  2661. % (But see \codedashfinish below.)
  2662. % Otherwise, it is too hard to avoid overfull hboxes
  2663. % in the Emacs manual, the Library manual, etc.
  2664. %
  2665. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  2666. % both hyphenation at - and hyphenation within words.
  2667. % We must therefore turn them both off (\tclose does that)
  2668. % and arrange explicitly to hyphenate at a dash. -- rms.
  2669. {
  2670. \catcode`\-=\active \catcode`\_=\active
  2671. \catcode`\'=\active \catcode`\`=\active
  2672. \global\let'=\rq \global\let`=\lq % default definitions
  2673. %
  2674. \global\def\code{\begingroup
  2675. \setupmarkupstyle{code}%
  2676. % The following should really be moved into \setupmarkupstyle handlers.
  2677. \catcode\dashChar=\active \catcode\underChar=\active
  2678. \ifallowcodebreaks
  2679. \let-\codedash
  2680. \let_\codeunder
  2681. \else
  2682. \let-\normaldash
  2683. \let_\realunder
  2684. \fi
  2685. % Given -foo (with a single dash), we do not want to allow a break
  2686. % after the hyphen.
  2687. \global\let\codedashprev=\codedash
  2688. %
  2689. \codex
  2690. }
  2691. %
  2692. \gdef\codedash{\futurelet\next\codedashfinish}
  2693. \gdef\codedashfinish{%
  2694. \normaldash % always output the dash character itself.
  2695. %
  2696. % Now, output a discretionary to allow a line break, unless
  2697. % (a) the next character is a -, or
  2698. % (b) the preceding character is a -.
  2699. % E.g., given --posix, we do not want to allow a break after either -.
  2700. % Given --foo-bar, we do want to allow a break between the - and the b.
  2701. \ifx\next\codedash \else
  2702. \ifx\codedashprev\codedash
  2703. \else \discretionary{}{}{}\fi
  2704. \fi
  2705. % we need the space after the = for the case when \next itself is a
  2706. % space token; it would get swallowed otherwise. As in @code{- a}.
  2707. \global\let\codedashprev= \next
  2708. }
  2709. }
  2710. \def\normaldash{-}
  2711. %
  2712. \def\codex #1{\tclose{#1}\endgroup}
  2713. \def\codeunder{%
  2714. % this is all so @math{@code{var_name}+1} can work. In math mode, _
  2715. % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.)
  2716. % will therefore expand the active definition of _, which is us
  2717. % (inside @code that is), therefore an endless loop.
  2718. \ifusingtt{\ifmmode
  2719. \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_.
  2720. \else\normalunderscore \fi
  2721. \discretionary{}{}{}}%
  2722. {\_}%
  2723. }
  2724. % An additional complication: the above will allow breaks after, e.g.,
  2725. % each of the four underscores in __typeof__. This is bad.
  2726. % @allowcodebreaks provides a document-level way to turn breaking at -
  2727. % and _ on and off.
  2728. %
  2729. \newif\ifallowcodebreaks \allowcodebreakstrue
  2730. \def\keywordtrue{true}
  2731. \def\keywordfalse{false}
  2732. \parseargdef\allowcodebreaks{%
  2733. \def\txiarg{#1}%
  2734. \ifx\txiarg\keywordtrue
  2735. \allowcodebreakstrue
  2736. \else\ifx\txiarg\keywordfalse
  2737. \allowcodebreaksfalse
  2738. \else
  2739. \errhelp = \EMsimple
  2740. \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
  2741. \fi\fi
  2742. }
  2743. % For @command, @env, @file, @option quotes seem unnecessary,
  2744. % so use \code rather than \samp.
  2745. \let\command=\code
  2746. \let\env=\code
  2747. \let\file=\code
  2748. \let\option=\code
  2749. % @uref (abbreviation for `urlref') aka @url takes an optional
  2750. % (comma-separated) second argument specifying the text to display and
  2751. % an optional third arg as text to display instead of (rather than in
  2752. % addition to) the url itself. First (mandatory) arg is the url.
  2753. % TeX-only option to allow changing PDF output to show only the second
  2754. % arg (if given), and not the url (which is then just the link target).
  2755. \newif\ifurefurlonlylink
  2756. % The main macro is \urefbreak, which allows breaking at expected
  2757. % places within the url. (There used to be another version, which
  2758. % didn't support automatic breaking.)
  2759. \def\urefbreak{\begingroup \urefcatcodes \dourefbreak}
  2760. \let\uref=\urefbreak
  2761. %
  2762. \def\dourefbreak#1{\urefbreakfinish #1,,,\finish}
  2763. \def\urefbreakfinish#1,#2,#3,#4\finish{% doesn't work in @example
  2764. \unsepspaces
  2765. \pdfurl{#1}%
  2766. \setbox0 = \hbox{\ignorespaces #3}%
  2767. \ifdim\wd0 > 0pt
  2768. \unhbox0 % third arg given, show only that
  2769. \else
  2770. \setbox0 = \hbox{\ignorespaces #2}% look for second arg
  2771. \ifdim\wd0 > 0pt
  2772. \ifpdf
  2773. % For pdfTeX and LuaTeX
  2774. \ifurefurlonlylink
  2775. % PDF plus option to not display url, show just arg
  2776. \unhbox0
  2777. \else
  2778. % PDF, normally display both arg and url for consistency,
  2779. % visibility, if the pdf is eventually used to print, etc.
  2780. \unhbox0\ (\urefcode{#1})%
  2781. \fi
  2782. \else
  2783. \ifx\XeTeXrevision\thisisundefined
  2784. \unhbox0\ (\urefcode{#1})% DVI, always show arg and url
  2785. \else
  2786. % For XeTeX
  2787. \ifurefurlonlylink
  2788. % PDF plus option to not display url, show just arg
  2789. \unhbox0
  2790. \else
  2791. % PDF, normally display both arg and url for consistency,
  2792. % visibility, if the pdf is eventually used to print, etc.
  2793. \unhbox0\ (\urefcode{#1})%
  2794. \fi
  2795. \fi
  2796. \fi
  2797. \else
  2798. \urefcode{#1}% only url given, so show it
  2799. \fi
  2800. \fi
  2801. \endlink
  2802. \endgroup}
  2803. % Allow line breaks around only a few characters (only).
  2804. \def\urefcatcodes{%
  2805. \catcode`\&=\active \catcode`\.=\active
  2806. \catcode`\#=\active \catcode`\?=\active
  2807. \catcode`\/=\active
  2808. }
  2809. {
  2810. \urefcatcodes
  2811. %
  2812. \global\def\urefcode{\begingroup
  2813. \setupmarkupstyle{code}%
  2814. \urefcatcodes
  2815. \let&\urefcodeamp
  2816. \let.\urefcodedot
  2817. \let#\urefcodehash
  2818. \let?\urefcodequest
  2819. \let/\urefcodeslash
  2820. \codex
  2821. }
  2822. %
  2823. % By default, they are just regular characters.
  2824. \global\def&{\normalamp}
  2825. \global\def.{\normaldot}
  2826. \global\def#{\normalhash}
  2827. \global\def?{\normalquest}
  2828. \global\def/{\normalslash}
  2829. }
  2830. % we put a little stretch before and after the breakable chars, to help
  2831. % line breaking of long url's. The unequal skips make look better in
  2832. % cmtt at least, especially for dots.
  2833. \def\urefprestretchamount{.13em}
  2834. \def\urefpoststretchamount{.1em}
  2835. \def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
  2836. \def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
  2837. %
  2838. \def\urefcodeamp{\urefprestretch \&\urefpoststretch}
  2839. \def\urefcodedot{\urefprestretch .\urefpoststretch}
  2840. \def\urefcodehash{\urefprestretch \#\urefpoststretch}
  2841. \def\urefcodequest{\urefprestretch ?\urefpoststretch}
  2842. \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
  2843. {
  2844. \catcode`\/=\active
  2845. \global\def\urefcodeslashfinish{%
  2846. \urefprestretch \slashChar
  2847. % Allow line break only after the final / in a sequence of
  2848. % slashes, to avoid line break between the slashes in http://.
  2849. \ifx\next/\else \urefpoststretch \fi
  2850. }
  2851. }
  2852. % One more complication: by default we'll break after the special
  2853. % characters, but some people like to break before the special chars, so
  2854. % allow that. Also allow no breaking at all, for manual control.
  2855. %
  2856. \parseargdef\urefbreakstyle{%
  2857. \def\txiarg{#1}%
  2858. \ifx\txiarg\wordnone
  2859. \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
  2860. \else\ifx\txiarg\wordbefore
  2861. \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
  2862. \else\ifx\txiarg\wordafter
  2863. \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
  2864. \else
  2865. \errhelp = \EMsimple
  2866. \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
  2867. \fi\fi\fi
  2868. }
  2869. \def\wordafter{after}
  2870. \def\wordbefore{before}
  2871. \def\wordnone{none}
  2872. \urefbreakstyle after
  2873. % @url synonym for @uref, since that's how everyone uses it.
  2874. %
  2875. \let\url=\uref
  2876. % rms does not like angle brackets --karl, 17may97.
  2877. % So now @email is just like @uref, unless we are pdf.
  2878. %
  2879. %\def\email#1{\angleleft{\tt #1}\angleright}
  2880. \ifpdf
  2881. \def\email#1{\doemail#1,,\finish}
  2882. \def\doemail#1,#2,#3\finish{\begingroup
  2883. \unsepspaces
  2884. \pdfurl{mailto:#1}%
  2885. \setbox0 = \hbox{\ignorespaces #2}%
  2886. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2887. \endlink
  2888. \endgroup}
  2889. \else
  2890. \ifx\XeTeXrevision\thisisundefined
  2891. \let\email=\uref
  2892. \else
  2893. \def\email#1{\doemail#1,,\finish}
  2894. \def\doemail#1,#2,#3\finish{\begingroup
  2895. \unsepspaces
  2896. \pdfurl{mailto:#1}%
  2897. \setbox0 = \hbox{\ignorespaces #2}%
  2898. \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
  2899. \endlink
  2900. \endgroup}
  2901. \fi
  2902. \fi
  2903. % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
  2904. % `example' (@kbd uses ttsl only inside of @example and friends),
  2905. % or `code' (@kbd uses normal tty font always).
  2906. \parseargdef\kbdinputstyle{%
  2907. \def\txiarg{#1}%
  2908. \ifx\txiarg\worddistinct
  2909. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}%
  2910. \else\ifx\txiarg\wordexample
  2911. \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}%
  2912. \else\ifx\txiarg\wordcode
  2913. \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}%
  2914. \else
  2915. \errhelp = \EMsimple
  2916. \errmessage{Unknown @kbdinputstyle setting `\txiarg'}%
  2917. \fi\fi\fi
  2918. }
  2919. \def\worddistinct{distinct}
  2920. \def\wordexample{example}
  2921. \def\wordcode{code}
  2922. % Default is `distinct'.
  2923. \kbdinputstyle distinct
  2924. % @kbd is like @code, except that if the argument is just one @key command,
  2925. % then @kbd has no effect.
  2926. \def\kbd#1{{\def\look{#1}\expandafter\kbdsub\look??\par}}
  2927. \def\xkey{\key}
  2928. \def\kbdsub#1#2#3\par{%
  2929. \def\one{#1}\def\three{#3}\def\threex{??}%
  2930. \ifx\one\xkey\ifx\threex\three \key{#2}%
  2931. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  2932. \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
  2933. }
  2934. % definition of @key that produces a lozenge. Doesn't adjust to text size.
  2935. %\setfont\keyrm\rmshape{8}{1000}{OT1}
  2936. %\font\keysy=cmsy9
  2937. %\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{%
  2938. % \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{%
  2939. % \vbox{\hrule\kern-0.4pt
  2940. % \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}%
  2941. % \kern-0.4pt\hrule}%
  2942. % \kern-.06em\raise0.4pt\hbox{\angleright}}}}
  2943. % definition of @key with no lozenge. If the current font is already
  2944. % monospace, don't change it; that way, we respect @kbdinputstyle. But
  2945. % if it isn't monospace, then use \tt.
  2946. %
  2947. \def\key#1{{\setupmarkupstyle{key}%
  2948. \nohyphenation
  2949. \ifmonospace\else\tt\fi
  2950. #1}\null}
  2951. % @clicksequence{File @click{} Open ...}
  2952. \def\clicksequence#1{\begingroup #1\endgroup}
  2953. % @clickstyle @arrow (by default)
  2954. \parseargdef\clickstyle{\def\click{#1}}
  2955. \def\click{\arrow}
  2956. % Typeset a dimension, e.g., `in' or `pt'. The only reason for the
  2957. % argument is to make the input look right: @dmn{pt} instead of @dmn{}pt.
  2958. %
  2959. \def\dmn#1{\thinspace #1}
  2960. % @acronym for "FBI", "NATO", and the like.
  2961. % We print this one point size smaller, since it's intended for
  2962. % all-uppercase.
  2963. %
  2964. \def\acronym#1{\doacronym #1,,\finish}
  2965. \def\doacronym#1,#2,#3\finish{%
  2966. {\switchtolsize #1}%
  2967. \def\temp{#2}%
  2968. \ifx\temp\empty \else
  2969. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  2970. \fi
  2971. \null % reset \spacefactor=1000
  2972. }
  2973. % @abbr for "Comput. J." and the like.
  2974. % No font change, but don't do end-of-sentence spacing.
  2975. %
  2976. \def\abbr#1{\doabbr #1,,\finish}
  2977. \def\doabbr#1,#2,#3\finish{%
  2978. {\plainfrenchspacing #1}%
  2979. \def\temp{#2}%
  2980. \ifx\temp\empty \else
  2981. \space ({\unsepspaces \ignorespaces \temp \unskip})%
  2982. \fi
  2983. \null % reset \spacefactor=1000
  2984. }
  2985. % @asis just yields its argument. Used with @table, for example.
  2986. %
  2987. \def\asis#1{#1}
  2988. % @math outputs its argument in math mode.
  2989. %
  2990. % One complication: _ usually means subscripts, but it could also mean
  2991. % an actual _ character, as in @math{@var{some_variable} + 1}. So make
  2992. % _ active, and distinguish by seeing if the current family is \slfam,
  2993. % which is what @var uses.
  2994. {
  2995. \catcode`\_ = \active
  2996. \gdef\mathunderscore{%
  2997. \catcode`\_=\active
  2998. \def_{\ifnum\fam=\slfam \_\else\sb\fi}%
  2999. }
  3000. }
  3001. % Another complication: we want \\ (and @\) to output a math (or tt) \.
  3002. % FYI, plain.tex uses \\ as a temporary control sequence (for no
  3003. % particular reason), but this is not advertised and we don't care.
  3004. %
  3005. % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\.
  3006. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi}
  3007. %
  3008. \def\math{%
  3009. \ifmmode\else % only go into math if not in math mode already
  3010. \tex
  3011. \mathunderscore
  3012. \let\\ = \mathbackslash
  3013. \mathactive
  3014. % make the texinfo accent commands work in math mode
  3015. \let\"=\ddot
  3016. \let\'=\acute
  3017. \let\==\bar
  3018. \let\^=\hat
  3019. \let\`=\grave
  3020. \let\u=\breve
  3021. \let\v=\check
  3022. \let\~=\tilde
  3023. \let\dotaccent=\dot
  3024. % have to provide another name for sup operator
  3025. \let\mathopsup=\sup
  3026. $\expandafter\finishmath\fi
  3027. }
  3028. \def\finishmath#1{#1$\endgroup} % Close the group opened by \tex.
  3029. % Some active characters (such as <) are spaced differently in math.
  3030. % We have to reset their definitions in case the @math was an argument
  3031. % to a command which sets the catcodes (such as @item or @section).
  3032. %
  3033. {
  3034. \catcode`^ = \active
  3035. \catcode`< = \active
  3036. \catcode`> = \active
  3037. \catcode`+ = \active
  3038. \catcode`' = \active
  3039. \gdef\mathactive{%
  3040. \let^ = \ptexhat
  3041. \let< = \ptexless
  3042. \let> = \ptexgtr
  3043. \let+ = \ptexplus
  3044. \let' = \ptexquoteright
  3045. }
  3046. }
  3047. % for @sub and @sup, if in math mode, just do a normal sub/superscript.
  3048. % If in text, use math to place as sub/superscript, but switch
  3049. % into text mode, with smaller fonts. This is a different font than the
  3050. % one used for real math sub/superscripts (8pt vs. 7pt), but let's not
  3051. % fix it (significant additions to font machinery) until someone notices.
  3052. %
  3053. \def\sub{\ifmmode \expandafter\sb \else \expandafter\finishsub\fi}
  3054. \def\finishsub#1{$\sb{\hbox{\switchtolllsize #1}}$}%
  3055. %
  3056. \def\sup{\ifmmode \expandafter\ptexsp \else \expandafter\finishsup\fi}
  3057. \def\finishsup#1{$\ptexsp{\hbox{\switchtolllsize #1}}$}%
  3058. % @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
  3059. % Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
  3060. % except specified as a normal braced arg, so no newlines to worry about.
  3061. %
  3062. \def\outfmtnametex{tex}
  3063. %
  3064. \long\def\inlinefmt#1{\doinlinefmt #1,\finish}
  3065. \long\def\doinlinefmt#1,#2,\finish{%
  3066. \def\inlinefmtname{#1}%
  3067. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
  3068. }
  3069. %
  3070. % @inlinefmtifelse{FMTNAME,THEN-TEXT,ELSE-TEXT} expands THEN-TEXT if
  3071. % FMTNAME is tex, else ELSE-TEXT.
  3072. \long\def\inlinefmtifelse#1{\doinlinefmtifelse #1,,,\finish}
  3073. \long\def\doinlinefmtifelse#1,#2,#3,#4,\finish{%
  3074. \def\inlinefmtname{#1}%
  3075. \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\else \ignorespaces #3\fi
  3076. }
  3077. %
  3078. % For raw, must switch into @tex before parsing the argument, to avoid
  3079. % setting catcodes prematurely. Doing it this way means that, for
  3080. % example, @inlineraw{html, foo{bar} gets a parse error instead of being
  3081. % ignored. But this isn't important because if people want a literal
  3082. % *right* brace they would have to use a command anyway, so they may as
  3083. % well use a command to get a left brace too. We could re-use the
  3084. % delimiter character idea from \verb, but it seems like overkill.
  3085. %
  3086. \long\def\inlineraw{\tex \doinlineraw}
  3087. \long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
  3088. \def\doinlinerawtwo#1,#2,\finish{%
  3089. \def\inlinerawname{#1}%
  3090. \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
  3091. \endgroup % close group opened by \tex.
  3092. }
  3093. % @inlineifset{VAR, TEXT} expands TEXT if VAR is @set.
  3094. %
  3095. \long\def\inlineifset#1{\doinlineifset #1,\finish}
  3096. \long\def\doinlineifset#1,#2,\finish{%
  3097. \def\inlinevarname{#1}%
  3098. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax
  3099. \else\ignorespaces#2\fi
  3100. }
  3101. % @inlineifclear{VAR, TEXT} expands TEXT if VAR is not @set.
  3102. %
  3103. \long\def\inlineifclear#1{\doinlineifclear #1,\finish}
  3104. \long\def\doinlineifclear#1,#2,\finish{%
  3105. \def\inlinevarname{#1}%
  3106. \expandafter\ifx\csname SET\inlinevarname\endcsname\relax \ignorespaces#2\fi
  3107. }
  3108. \message{glyphs,}
  3109. % and logos.
  3110. % @@ prints an @, as does @atchar{}.
  3111. \def\@{\char64 }
  3112. \let\atchar=\@
  3113. % @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
  3114. \def\lbracechar{{\ifmonospace\char123\else\ensuremath\lbrace\fi}}
  3115. \def\rbracechar{{\ifmonospace\char125\else\ensuremath\rbrace\fi}}
  3116. \let\{=\lbracechar
  3117. \let\}=\rbracechar
  3118. % @comma{} to avoid , parsing problems.
  3119. \let\comma = ,
  3120. % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent
  3121. % Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H.
  3122. \let\, = \ptexc
  3123. \let\dotaccent = \ptexdot
  3124. \def\ringaccent#1{{\accent23 #1}}
  3125. \let\tieaccent = \ptext
  3126. \let\ubaraccent = \ptexb
  3127. \let\udotaccent = \d
  3128. % Other special characters: @questiondown @exclamdown @ordf @ordm
  3129. % Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss.
  3130. \def\questiondown{?`}
  3131. \def\exclamdown{!`}
  3132. \def\ordf{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{a}}}
  3133. \def\ordm{\leavevmode\raise1ex\hbox{\switchtolllsize \underbar{o}}}
  3134. % Dotless i and dotless j, used for accents.
  3135. \def\imacro{i}
  3136. \def\jmacro{j}
  3137. \def\dotless#1{%
  3138. \def\temp{#1}%
  3139. \ifx\temp\imacro \ifmmode\imath \else\ptexi \fi
  3140. \else\ifx\temp\jmacro \ifmmode\jmath \else\j \fi
  3141. \else \errmessage{@dotless can be used only with i or j}%
  3142. \fi\fi
  3143. }
  3144. % The \TeX{} logo, as in plain, but resetting the spacing so that a
  3145. % period following counts as ending a sentence. (Idea found in latex.)
  3146. %
  3147. \edef\TeX{\TeX \spacefactor=1000 }
  3148. % @LaTeX{} logo. Not quite the same results as the definition in
  3149. % latex.ltx, since we use a different font for the raised A; it's most
  3150. % convenient for us to use an explicitly smaller font, rather than using
  3151. % the \scriptstyle font (since we don't reset \scriptstyle and
  3152. % \scriptscriptstyle).
  3153. %
  3154. \def\LaTeX{%
  3155. L\kern-.36em
  3156. {\setbox0=\hbox{T}%
  3157. \vbox to \ht0{\hbox{%
  3158. \ifx\textnominalsize\xwordpt
  3159. % for 10pt running text, lllsize (8pt) is too small for the A in LaTeX.
  3160. % Revert to plain's \scriptsize, which is 7pt.
  3161. \count255=\the\fam $\fam\count255 \scriptstyle A$%
  3162. \else
  3163. % For 11pt, we can use our lllsize.
  3164. \switchtolllsize A%
  3165. \fi
  3166. }%
  3167. \vss
  3168. }}%
  3169. \kern-.15em
  3170. \TeX
  3171. }
  3172. % Some math mode symbols. Define \ensuremath to switch into math mode
  3173. % unless we are already there. Expansion tricks may not be needed here,
  3174. % but safer, and can't hurt.
  3175. \def\ensuremath{\ifmmode \expandafter\asis \else\expandafter\ensuredmath \fi}
  3176. \def\ensuredmath#1{$\relax#1$}
  3177. %
  3178. \def\bullet{\ensuremath\ptexbullet}
  3179. \def\geq{\ensuremath\ge}
  3180. \def\leq{\ensuremath\le}
  3181. \def\minus{\ensuremath-}
  3182. % @dots{} outputs an ellipsis using the current font.
  3183. % We do .5em per period so that it has the same spacing in the cm
  3184. % typewriter fonts as three actual period characters; on the other hand,
  3185. % in other typewriter fonts three periods are wider than 1.5em. So do
  3186. % whichever is larger.
  3187. %
  3188. \def\dots{%
  3189. \leavevmode
  3190. \setbox0=\hbox{...}% get width of three periods
  3191. \ifdim\wd0 > 1.5em
  3192. \dimen0 = \wd0
  3193. \else
  3194. \dimen0 = 1.5em
  3195. \fi
  3196. \hbox to \dimen0{%
  3197. \hskip 0pt plus.25fil
  3198. .\hskip 0pt plus1fil
  3199. .\hskip 0pt plus1fil
  3200. .\hskip 0pt plus.5fil
  3201. }%
  3202. }
  3203. % @enddots{} is an end-of-sentence ellipsis.
  3204. %
  3205. \def\enddots{%
  3206. \dots
  3207. \spacefactor=\endofsentencespacefactor
  3208. }
  3209. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}.
  3210. %
  3211. % Since these characters are used in examples, they should be an even number of
  3212. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  3213. %
  3214. \def\point{$\star$}
  3215. \def\arrow{\leavevmode\raise.05ex\hbox to 1em{\hfil$\rightarrow$\hfil}}
  3216. \def\result{\leavevmode\raise.05ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  3217. \def\expansion{\leavevmode\hbox to 1em{\hfil$\mapsto$\hfil}}
  3218. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  3219. \def\equiv{\leavevmode\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  3220. % The @error{} command.
  3221. % Adapted from the TeXbook's \boxit.
  3222. %
  3223. \newbox\errorbox
  3224. %
  3225. {\ttfont \global\dimen0 = 3em}% Width of the box.
  3226. \dimen2 = .55pt % Thickness of rules
  3227. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  3228. \setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
  3229. %
  3230. \setbox\errorbox=\hbox to \dimen0{\hfil
  3231. \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  3232. \advance\hsize by -2\dimen2 % Rules.
  3233. \vbox{%
  3234. \hrule height\dimen2
  3235. \hbox{\vrule width\dimen2 \kern3pt % Space to left of text.
  3236. \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  3237. \kern3pt\vrule width\dimen2}% Space to right.
  3238. \hrule height\dimen2}
  3239. \hfil}
  3240. %
  3241. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  3242. % @pounds{} is a sterling sign, which Knuth put in the CM italic font.
  3243. %
  3244. \def\pounds{{\it\$}}
  3245. % @euro{} comes from a separate font, depending on the current style.
  3246. % We use the free feym* fonts from the eurosym package by Henrik
  3247. % Theiling, which support regular, slanted, bold and bold slanted (and
  3248. % "outlined" (blackboard board, sort of) versions, which we don't need).
  3249. % It is available from http://www.ctan.org/tex-archive/fonts/eurosym.
  3250. %
  3251. % Although only regular is the truly official Euro symbol, we ignore
  3252. % that. The Euro is designed to be slightly taller than the regular
  3253. % font height.
  3254. %
  3255. % feymr - regular
  3256. % feymo - slanted
  3257. % feybr - bold
  3258. % feybo - bold slanted
  3259. %
  3260. % There is no good (free) typewriter version, to my knowledge.
  3261. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide.
  3262. % Hmm.
  3263. %
  3264. % Also doesn't work in math. Do we need to do math with euro symbols?
  3265. % Hope not.
  3266. %
  3267. %
  3268. \def\euro{{\eurofont e}}
  3269. \def\eurofont{%
  3270. % We set the font at each command, rather than predefining it in
  3271. % \textfonts and the other font-switching commands, so that
  3272. % installations which never need the symbol don't have to have the
  3273. % font installed.
  3274. %
  3275. % There is only one designed size (nominal 10pt), so we always scale
  3276. % that to the current nominal size.
  3277. %
  3278. % By the way, simply using "at 1em" works for cmr10 and the like, but
  3279. % does not work for cmbx10 and other extended/shrunken fonts.
  3280. %
  3281. \def\eurosize{\csname\curfontsize nominalsize\endcsname}%
  3282. %
  3283. \ifx\curfontstyle\bfstylename
  3284. % bold:
  3285. \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize
  3286. \else
  3287. % regular:
  3288. \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize
  3289. \fi
  3290. \thiseurofont
  3291. }
  3292. % Glyphs from the EC fonts. We don't use \let for the aliases, because
  3293. % sometimes we redefine the original macro, and the alias should reflect
  3294. % the redefinition.
  3295. %
  3296. % Use LaTeX names for the Icelandic letters.
  3297. \def\DH{{\ecfont \char"D0}} % Eth
  3298. \def\dh{{\ecfont \char"F0}} % eth
  3299. \def\TH{{\ecfont \char"DE}} % Thorn
  3300. \def\th{{\ecfont \char"FE}} % thorn
  3301. %
  3302. \def\guillemetleft{{\ecfont \char"13}}
  3303. \def\guillemotleft{\guillemetleft}
  3304. \def\guillemetright{{\ecfont \char"14}}
  3305. \def\guillemotright{\guillemetright}
  3306. \def\guilsinglleft{{\ecfont \char"0E}}
  3307. \def\guilsinglright{{\ecfont \char"0F}}
  3308. \def\quotedblbase{{\ecfont \char"12}}
  3309. \def\quotesinglbase{{\ecfont \char"0D}}
  3310. %
  3311. % This positioning is not perfect (see the ogonek LaTeX package), but
  3312. % we have the precomposed glyphs for the most common cases. We put the
  3313. % tests to use those glyphs in the single \ogonek macro so we have fewer
  3314. % dummy definitions to worry about for index entries, etc.
  3315. %
  3316. % ogonek is also used with other letters in Lithuanian (IOU), but using
  3317. % the precomposed glyphs for those is not so easy since they aren't in
  3318. % the same EC font.
  3319. \def\ogonek#1{{%
  3320. \def\temp{#1}%
  3321. \ifx\temp\macrocharA\Aogonek
  3322. \else\ifx\temp\macrochara\aogonek
  3323. \else\ifx\temp\macrocharE\Eogonek
  3324. \else\ifx\temp\macrochare\eogonek
  3325. \else
  3326. \ecfont \setbox0=\hbox{#1}%
  3327. \ifdim\ht0=1ex\accent"0C #1%
  3328. \else\ooalign{\unhbox0\crcr\hidewidth\char"0C \hidewidth}%
  3329. \fi
  3330. \fi\fi\fi\fi
  3331. }%
  3332. }
  3333. \def\Aogonek{{\ecfont \char"81}}\def\macrocharA{A}
  3334. \def\aogonek{{\ecfont \char"A1}}\def\macrochara{a}
  3335. \def\Eogonek{{\ecfont \char"86}}\def\macrocharE{E}
  3336. \def\eogonek{{\ecfont \char"A6}}\def\macrochare{e}
  3337. %
  3338. % Use the European Computer Modern fonts (cm-super in outline format)
  3339. % for non-CM glyphs. That is ec* for regular text and tc* for the text
  3340. % companion symbols (LaTeX TS1 encoding). Both are part of the ec
  3341. % package and follow the same conventions.
  3342. %
  3343. \def\ecfont{\etcfont{e}}
  3344. \def\tcfont{\etcfont{t}}
  3345. %
  3346. \def\etcfont#1{%
  3347. % We can't distinguish serif/sans and italic/slanted, but this
  3348. % is used for crude hacks anyway (like adding French and German
  3349. % quotes to documents typeset with CM, where we lose kerning), so
  3350. % hopefully nobody will notice/care.
  3351. \edef\ecsize{\csname\curfontsize ecsize\endcsname}%
  3352. \edef\nominalsize{\csname\curfontsize nominalsize\endcsname}%
  3353. \ifmonospace
  3354. % typewriter:
  3355. \font\thisecfont = #1ctt\ecsize \space at \nominalsize
  3356. \else
  3357. \ifx\curfontstyle\bfstylename
  3358. % bold:
  3359. \font\thisecfont = #1cb\ifusingit{i}{x}\ecsize \space at \nominalsize
  3360. \else
  3361. % regular:
  3362. \font\thisecfont = #1c\ifusingit{ti}{rm}\ecsize \space at \nominalsize
  3363. \fi
  3364. \fi
  3365. \thisecfont
  3366. }
  3367. % @registeredsymbol - R in a circle. The font for the R should really
  3368. % be smaller yet, but lllsize is the best we can do for now.
  3369. % Adapted from the plain.tex definition of \copyright.
  3370. %
  3371. \def\registeredsymbol{%
  3372. $^{{\ooalign{\hfil\raise.07ex\hbox{\switchtolllsize R}%
  3373. \hfil\crcr\Orb}}%
  3374. }$%
  3375. }
  3376. % @textdegree - the normal degrees sign.
  3377. %
  3378. \def\textdegree{$^\circ$}
  3379. % Laurent Siebenmann reports \Orb undefined with:
  3380. % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38
  3381. % so we'll define it if necessary.
  3382. %
  3383. \ifx\Orb\thisisundefined
  3384. \def\Orb{\mathhexbox20D}
  3385. \fi
  3386. % Quotes.
  3387. \chardef\quotedblleft="5C
  3388. \chardef\quotedblright=`\"
  3389. \chardef\quoteleft=`\`
  3390. \chardef\quoteright=`\'
  3391. \message{page headings,}
  3392. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  3393. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  3394. % First the title page. Must do @settitle before @titlepage.
  3395. \newif\ifseenauthor
  3396. \newif\iffinishedtitlepage
  3397. % @setcontentsaftertitlepage used to do an implicit @contents or
  3398. % @shortcontents after @end titlepage, but it is now obsolete.
  3399. \def\setcontentsaftertitlepage{%
  3400. \errmessage{@setcontentsaftertitlepage has been removed as a Texinfo
  3401. command; move your @contents command if you want the contents
  3402. after the title page.}}%
  3403. \def\setshortcontentsaftertitlepage{%
  3404. \errmessage{@setshortcontentsaftertitlepage has been removed as a Texinfo
  3405. command; move your @shortcontents and @contents commands if you
  3406. want the contents after the title page.}}%
  3407. \parseargdef\shorttitlepage{%
  3408. \begingroup \hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  3409. \endgroup\page\hbox{}\page}
  3410. \envdef\titlepage{%
  3411. % Open one extra group, as we want to close it in the middle of \Etitlepage.
  3412. \begingroup
  3413. \parindent=0pt \textfonts
  3414. % Leave some space at the very top of the page.
  3415. \vglue\titlepagetopglue
  3416. % No rule at page bottom unless we print one at the top with @title.
  3417. \finishedtitlepagetrue
  3418. %
  3419. % Most title ``pages'' are actually two pages long, with space
  3420. % at the top of the second. We don't want the ragged left on the second.
  3421. \let\oldpage = \page
  3422. \def\page{%
  3423. \iffinishedtitlepage\else
  3424. \finishtitlepage
  3425. \fi
  3426. \let\page = \oldpage
  3427. \page
  3428. \null
  3429. }%
  3430. }
  3431. \def\Etitlepage{%
  3432. \iffinishedtitlepage\else
  3433. \finishtitlepage
  3434. \fi
  3435. % It is important to do the page break before ending the group,
  3436. % because the headline and footline are only empty inside the group.
  3437. % If we use the new definition of \page, we always get a blank page
  3438. % after the title page, which we certainly don't want.
  3439. \oldpage
  3440. \endgroup
  3441. %
  3442. % Need this before the \...aftertitlepage checks so that if they are
  3443. % in effect the toc pages will come out with page numbers.
  3444. \HEADINGSon
  3445. }
  3446. \def\finishtitlepage{%
  3447. \vskip4pt \hrule height 2pt width \hsize
  3448. \vskip\titlepagebottomglue
  3449. \finishedtitlepagetrue
  3450. }
  3451. % Settings used for typesetting titles: no hyphenation, no indentation,
  3452. % don't worry much about spacing, ragged right. This should be used
  3453. % inside a \vbox, and fonts need to be set appropriately first. \par should
  3454. % be specified before the end of the \vbox, since a vbox is a group.
  3455. %
  3456. \def\raggedtitlesettings{%
  3457. \rm
  3458. \hyphenpenalty=10000
  3459. \parindent=0pt
  3460. \tolerance=5000
  3461. \ptexraggedright
  3462. }
  3463. % Macros to be used within @titlepage:
  3464. \let\subtitlerm=\rmfont
  3465. \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
  3466. \parseargdef\title{%
  3467. \checkenv\titlepage
  3468. \vbox{\titlefonts \raggedtitlesettings #1\par}%
  3469. % print a rule at the page bottom also.
  3470. \finishedtitlepagefalse
  3471. \vskip4pt \hrule height 4pt width \hsize \vskip4pt
  3472. }
  3473. \parseargdef\subtitle{%
  3474. \checkenv\titlepage
  3475. {\subtitlefont \rightline{#1}}%
  3476. }
  3477. % @author should come last, but may come many times.
  3478. % It can also be used inside @quotation.
  3479. %
  3480. \parseargdef\author{%
  3481. \def\temp{\quotation}%
  3482. \ifx\thisenv\temp
  3483. \def\quotationauthor{#1}% printed in \Equotation.
  3484. \else
  3485. \checkenv\titlepage
  3486. \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
  3487. {\secfonts\rm \leftline{#1}}%
  3488. \fi
  3489. }
  3490. % Set up page headings and footings.
  3491. \let\thispage=\folio
  3492. \newtoks\evenheadline % headline on even pages
  3493. \newtoks\oddheadline % headline on odd pages
  3494. \newtoks\evenfootline % footline on even pages
  3495. \newtoks\oddfootline % footline on odd pages
  3496. % Now make \makeheadline and \makefootline in Plain TeX use those variables
  3497. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  3498. \else \the\evenheadline \fi}}
  3499. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  3500. \else \the\evenfootline \fi}\HEADINGShook}
  3501. \let\HEADINGShook=\relax
  3502. % Commands to set those variables.
  3503. % For example, this is what @headings on does
  3504. % @evenheading @thistitle|@thispage|@thischapter
  3505. % @oddheading @thischapter|@thispage|@thistitle
  3506. % @evenfooting @thisfile||
  3507. % @oddfooting ||@thisfile
  3508. \def\evenheading{\parsearg\evenheadingxxx}
  3509. \def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish}
  3510. \def\evenheadingyyy #1\|#2\|#3\|#4\finish{%
  3511. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3512. \def\oddheading{\parsearg\oddheadingxxx}
  3513. \def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish}
  3514. \def\oddheadingyyy #1\|#2\|#3\|#4\finish{%
  3515. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3516. \parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}%
  3517. \def\evenfooting{\parsearg\evenfootingxxx}
  3518. \def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish}
  3519. \def\evenfootingyyy #1\|#2\|#3\|#4\finish{%
  3520. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  3521. \def\oddfooting{\parsearg\oddfootingxxx}
  3522. \def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish}
  3523. \def\oddfootingyyy #1\|#2\|#3\|#4\finish{%
  3524. \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}%
  3525. %
  3526. % Leave some space for the footline. Hopefully ok to assume
  3527. % @evenfooting will not be used by itself.
  3528. \global\advance\txipageheight by -12pt
  3529. \global\advance\vsize by -12pt
  3530. }
  3531. \parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}}
  3532. % @evenheadingmarks top \thischapter <- chapter at the top of a page
  3533. % @evenheadingmarks bottom \thischapter <- chapter at the bottom of a page
  3534. %
  3535. % The same set of arguments for:
  3536. %
  3537. % @oddheadingmarks
  3538. % @evenfootingmarks
  3539. % @oddfootingmarks
  3540. % @everyheadingmarks
  3541. % @everyfootingmarks
  3542. % These define \getoddheadingmarks, \getevenheadingmarks,
  3543. % \getoddfootingmarks, and \getevenfootingmarks, each to one of
  3544. % \gettopheadingmarks, \getbottomheadingmarks.
  3545. %
  3546. \def\evenheadingmarks{\headingmarks{even}{heading}}
  3547. \def\oddheadingmarks{\headingmarks{odd}{heading}}
  3548. \def\evenfootingmarks{\headingmarks{even}{footing}}
  3549. \def\oddfootingmarks{\headingmarks{odd}{footing}}
  3550. \parseargdef\everyheadingmarks{\headingmarks{even}{heading}{#1}
  3551. \headingmarks{odd}{heading}{#1} }
  3552. \parseargdef\everyfootingmarks{\headingmarks{even}{footing}{#1}
  3553. \headingmarks{odd}{footing}{#1} }
  3554. % #1 = even/odd, #2 = heading/footing, #3 = top/bottom.
  3555. \def\headingmarks#1#2#3 {%
  3556. \expandafter\let\expandafter\temp \csname get#3headingmarks\endcsname
  3557. \global\expandafter\let\csname get#1#2marks\endcsname \temp
  3558. }
  3559. \everyheadingmarks bottom
  3560. \everyfootingmarks bottom
  3561. % @headings double turns headings on for double-sided printing.
  3562. % @headings single turns headings on for single-sided printing.
  3563. % @headings off turns them off.
  3564. % @headings on same as @headings double, retained for compatibility.
  3565. % @headings after turns on double-sided headings after this page.
  3566. % @headings doubleafter turns on double-sided headings after this page.
  3567. % @headings singleafter turns on single-sided headings after this page.
  3568. % By default, they are off at the start of a document,
  3569. % and turned `on' after @end titlepage.
  3570. \parseargdef\headings{\csname HEADINGS#1\endcsname}
  3571. \def\headingsoff{% non-global headings elimination
  3572. \evenheadline={\hfil}\evenfootline={\hfil}%
  3573. \oddheadline={\hfil}\oddfootline={\hfil}%
  3574. }
  3575. \def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
  3576. \HEADINGSoff % it's the default
  3577. % When we turn headings on, set the page number to 1.
  3578. % For double-sided printing, put current file name in lower left corner,
  3579. % chapter name on inside top of right hand pages, document
  3580. % title on inside top of left hand pages, and page numbers on outside top
  3581. % edge of all pages.
  3582. \def\HEADINGSdouble{%
  3583. \global\pageno=1
  3584. \global\evenfootline={\hfil}
  3585. \global\oddfootline={\hfil}
  3586. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3587. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3588. \global\let\contentsalignmacro = \chapoddpage
  3589. }
  3590. \let\contentsalignmacro = \chappager
  3591. % For single-sided printing, chapter title goes across top left of page,
  3592. % page number on top right.
  3593. \def\HEADINGSsingle{%
  3594. \global\pageno=1
  3595. \global\evenfootline={\hfil}
  3596. \global\oddfootline={\hfil}
  3597. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3598. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3599. \global\let\contentsalignmacro = \chappager
  3600. }
  3601. \def\HEADINGSon{\HEADINGSdouble}
  3602. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  3603. \let\HEADINGSdoubleafter=\HEADINGSafter
  3604. \def\HEADINGSdoublex{%
  3605. \global\evenfootline={\hfil}
  3606. \global\oddfootline={\hfil}
  3607. \global\evenheadline={\line{\folio\hfil\thistitle}}
  3608. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3609. \global\let\contentsalignmacro = \chapoddpage
  3610. }
  3611. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  3612. \def\HEADINGSsinglex{%
  3613. \global\evenfootline={\hfil}
  3614. \global\oddfootline={\hfil}
  3615. \global\evenheadline={\line{\thischapterheading\hfil\folio}}
  3616. \global\oddheadline={\line{\thischapterheading\hfil\folio}}
  3617. \global\let\contentsalignmacro = \chappager
  3618. }
  3619. % Subroutines used in generating headings
  3620. % This produces Day Month Year style of output.
  3621. % Only define if not already defined, in case a txi-??.tex file has set
  3622. % up a different format (e.g., txi-cs.tex does this).
  3623. \ifx\today\thisisundefined
  3624. \def\today{%
  3625. \number\day\space
  3626. \ifcase\month
  3627. \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr
  3628. \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug
  3629. \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec
  3630. \fi
  3631. \space\number\year}
  3632. \fi
  3633. % @settitle line... specifies the title of the document, for headings.
  3634. % It generates no output of its own.
  3635. \def\thistitle{\putwordNoTitle}
  3636. \def\settitle{\parsearg{\gdef\thistitle}}
  3637. \message{tables,}
  3638. % Tables -- @table, @ftable, @vtable, @item(x).
  3639. % default indentation of table text
  3640. \newdimen\tableindent \tableindent=.8in
  3641. % default indentation of @itemize and @enumerate text
  3642. \newdimen\itemindent \itemindent=.3in
  3643. % margin between end of table item and start of table text.
  3644. \newdimen\itemmargin \itemmargin=.1in
  3645. % used internally for \itemindent minus \itemmargin
  3646. \newdimen\itemmax
  3647. % Note @table, @ftable, and @vtable define @item, @itemx, etc., with
  3648. % these defs.
  3649. % They also define \itemindex
  3650. % to index the item name in whatever manner is desired (perhaps none).
  3651. \newif\ifitemxneedsnegativevskip
  3652. \def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi}
  3653. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  3654. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  3655. \def\itemzzz #1{\begingroup %
  3656. \advance\hsize by -\rightskip
  3657. \advance\hsize by -\tableindent
  3658. \setbox0=\hbox{\itemindicate{#1}}%
  3659. \itemindex{#1}%
  3660. \nobreak % This prevents a break before @itemx.
  3661. %
  3662. % If the item text does not fit in the space we have, put it on a line
  3663. % by itself, and do not allow a page break either before or after that
  3664. % line. We do not start a paragraph here because then if the next
  3665. % command is, e.g., @kindex, the whatsit would get put into the
  3666. % horizontal list on a line by itself, resulting in extra blank space.
  3667. \ifdim \wd0>\itemmax
  3668. %
  3669. % Make this a paragraph so we get the \parskip glue and wrapping,
  3670. % but leave it ragged-right.
  3671. \begingroup
  3672. \advance\leftskip by-\tableindent
  3673. \advance\hsize by\tableindent
  3674. \advance\rightskip by0pt plus1fil\relax
  3675. \leavevmode\unhbox0\par
  3676. \endgroup
  3677. %
  3678. % We're going to be starting a paragraph, but we don't want the
  3679. % \parskip glue -- logically it's part of the @item we just started.
  3680. \nobreak \vskip-\parskip
  3681. %
  3682. % Stop a page break at the \parskip glue coming up. However, if
  3683. % what follows is an environment such as @example, there will be no
  3684. % \parskip glue; then the negative vskip we just inserted would
  3685. % cause the example and the item to crash together. So we use this
  3686. % bizarre value of 10001 as a signal to \aboveenvbreak to insert
  3687. % \parskip glue after all. Section titles are handled this way also.
  3688. %
  3689. \penalty 10001
  3690. \endgroup
  3691. \itemxneedsnegativevskipfalse
  3692. \else
  3693. % The item text fits into the space. Start a paragraph, so that the
  3694. % following text (if any) will end up on the same line.
  3695. \noindent
  3696. % Do this with kerns and \unhbox so that if there is a footnote in
  3697. % the item text, it can migrate to the main vertical list and
  3698. % eventually be printed.
  3699. \nobreak\kern-\tableindent
  3700. \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0
  3701. \unhbox0
  3702. \nobreak\kern\dimen0
  3703. \endgroup
  3704. \itemxneedsnegativevskiptrue
  3705. \fi
  3706. }
  3707. \def\item{\errmessage{@item while not in a list environment}}
  3708. \def\itemx{\errmessage{@itemx while not in a list environment}}
  3709. % @table, @ftable, @vtable.
  3710. \envdef\table{%
  3711. \let\itemindex\gobble
  3712. \tablecheck{table}%
  3713. }
  3714. \envdef\ftable{%
  3715. \def\itemindex ##1{\doind {fn}{\code{##1}}}%
  3716. \tablecheck{ftable}%
  3717. }
  3718. \envdef\vtable{%
  3719. \def\itemindex ##1{\doind {vr}{\code{##1}}}%
  3720. \tablecheck{vtable}%
  3721. }
  3722. \def\tablecheck#1{%
  3723. \ifnum \the\catcode`\^^M=\active
  3724. \endgroup
  3725. \errmessage{This command won't work in this context; perhaps the problem is
  3726. that we are \inenvironment\thisenv}%
  3727. \def\next{\doignore{#1}}%
  3728. \else
  3729. \let\next\tablex
  3730. \fi
  3731. \next
  3732. }
  3733. \def\tablex#1{%
  3734. \def\itemindicate{#1}%
  3735. \parsearg\tabley
  3736. }
  3737. \def\tabley#1{%
  3738. {%
  3739. \makevalueexpandable
  3740. \edef\temp{\noexpand\tablez #1\space\space\space}%
  3741. \expandafter
  3742. }\temp \endtablez
  3743. }
  3744. \def\tablez #1 #2 #3 #4\endtablez{%
  3745. \aboveenvbreak
  3746. \ifnum 0#1>0 \advance \leftskip by #1\mil \fi
  3747. \ifnum 0#2>0 \tableindent=#2\mil \fi
  3748. \ifnum 0#3>0 \advance \rightskip by #3\mil \fi
  3749. \itemmax=\tableindent
  3750. \advance \itemmax by -\itemmargin
  3751. \advance \leftskip by \tableindent
  3752. \exdentamount=\tableindent
  3753. \parindent = 0pt
  3754. \parskip = \smallskipamount
  3755. \ifdim \parskip=0pt \parskip=2pt \fi
  3756. \let\item = \internalBitem
  3757. \let\itemx = \internalBitemx
  3758. }
  3759. \def\Etable{\endgraf\afterenvbreak}
  3760. \let\Eftable\Etable
  3761. \let\Evtable\Etable
  3762. \let\Eitemize\Etable
  3763. \let\Eenumerate\Etable
  3764. % This is the counter used by @enumerate, which is really @itemize
  3765. \newcount \itemno
  3766. \envdef\itemize{\parsearg\doitemize}
  3767. \def\doitemize#1{%
  3768. \aboveenvbreak
  3769. \itemmax=\itemindent
  3770. \advance\itemmax by -\itemmargin
  3771. \advance\leftskip by \itemindent
  3772. \exdentamount=\itemindent
  3773. \parindent=0pt
  3774. \parskip=\smallskipamount
  3775. \ifdim\parskip=0pt \parskip=2pt \fi
  3776. %
  3777. % Try typesetting the item mark so that if the document erroneously says
  3778. % something like @itemize @samp (intending @table), there's an error
  3779. % right away at the @itemize. It's not the best error message in the
  3780. % world, but it's better than leaving it to the @item. This means if
  3781. % the user wants an empty mark, they have to say @w{} not just @w.
  3782. \def\itemcontents{#1}%
  3783. \setbox0 = \hbox{\itemcontents}%
  3784. %
  3785. % @itemize with no arg is equivalent to @itemize @bullet.
  3786. \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi
  3787. %
  3788. \let\item=\itemizeitem
  3789. }
  3790. % Definition of @item while inside @itemize and @enumerate.
  3791. %
  3792. \def\itemizeitem{%
  3793. \advance\itemno by 1 % for enumerations
  3794. {\let\par=\endgraf \smallbreak}% reasonable place to break
  3795. {%
  3796. % If the document has an @itemize directly after a section title, a
  3797. % \nobreak will be last on the list, and \sectionheading will have
  3798. % done a \vskip-\parskip. In that case, we don't want to zero
  3799. % parskip, or the item text will crash with the heading. On the
  3800. % other hand, when there is normal text preceding the item (as there
  3801. % usually is), we do want to zero parskip, or there would be too much
  3802. % space. In that case, we won't have a \nobreak before. At least
  3803. % that's the theory.
  3804. \ifnum\lastpenalty<10000 \parskip=0in \fi
  3805. \noindent
  3806. \hbox to 0pt{\hss \itemcontents \kern\itemmargin}%
  3807. %
  3808. \ifinner\else
  3809. \vadjust{\penalty 1200}% not good to break after first line of item.
  3810. \fi
  3811. % We can be in inner vertical mode in a footnote, although an
  3812. % @itemize looks awful there.
  3813. }%
  3814. \flushcr
  3815. }
  3816. % \splitoff TOKENS\endmark defines \first to be the first token in
  3817. % TOKENS, and \rest to be the remainder.
  3818. %
  3819. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  3820. % Allow an optional argument of an uppercase letter, lowercase letter,
  3821. % or number, to specify the first label in the enumerated list. No
  3822. % argument is the same as `1'.
  3823. %
  3824. \envparseargdef\enumerate{\enumeratey #1 \endenumeratey}
  3825. \def\enumeratey #1 #2\endenumeratey{%
  3826. % If we were given no argument, pretend we were given `1'.
  3827. \def\thearg{#1}%
  3828. \ifx\thearg\empty \def\thearg{1}\fi
  3829. %
  3830. % Detect if the argument is a single token. If so, it might be a
  3831. % letter. Otherwise, the only valid thing it can be is a number.
  3832. % (We will always have one token, because of the test we just made.
  3833. % This is a good thing, since \splitoff doesn't work given nothing at
  3834. % all -- the first parameter is undelimited.)
  3835. \expandafter\splitoff\thearg\endmark
  3836. \ifx\rest\empty
  3837. % Only one token in the argument. It could still be anything.
  3838. % A ``lowercase letter'' is one whose \lccode is nonzero.
  3839. % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  3840. % not equal to itself.
  3841. % Otherwise, we assume it's a number.
  3842. %
  3843. % We need the \relax at the end of the \ifnum lines to stop TeX from
  3844. % continuing to look for a <number>.
  3845. %
  3846. \ifnum\lccode\expandafter`\thearg=0\relax
  3847. \numericenumerate % a number (we hope)
  3848. \else
  3849. % It's a letter.
  3850. \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  3851. \lowercaseenumerate % lowercase letter
  3852. \else
  3853. \uppercaseenumerate % uppercase letter
  3854. \fi
  3855. \fi
  3856. \else
  3857. % Multiple tokens in the argument. We hope it's a number.
  3858. \numericenumerate
  3859. \fi
  3860. }
  3861. % An @enumerate whose labels are integers. The starting integer is
  3862. % given in \thearg.
  3863. %
  3864. \def\numericenumerate{%
  3865. \itemno = \thearg
  3866. \startenumeration{\the\itemno}%
  3867. }
  3868. % The starting (lowercase) letter is in \thearg.
  3869. \def\lowercaseenumerate{%
  3870. \itemno = \expandafter`\thearg
  3871. \startenumeration{%
  3872. % Be sure we're not beyond the end of the alphabet.
  3873. \ifnum\itemno=0
  3874. \errmessage{No more lowercase letters in @enumerate; get a bigger
  3875. alphabet}%
  3876. \fi
  3877. \char\lccode\itemno
  3878. }%
  3879. }
  3880. % The starting (uppercase) letter is in \thearg.
  3881. \def\uppercaseenumerate{%
  3882. \itemno = \expandafter`\thearg
  3883. \startenumeration{%
  3884. % Be sure we're not beyond the end of the alphabet.
  3885. \ifnum\itemno=0
  3886. \errmessage{No more uppercase letters in @enumerate; get a bigger
  3887. alphabet}
  3888. \fi
  3889. \char\uccode\itemno
  3890. }%
  3891. }
  3892. % Call \doitemize, adding a period to the first argument and supplying the
  3893. % common last two arguments. Also subtract one from the initial value in
  3894. % \itemno, since @item increments \itemno.
  3895. %
  3896. \def\startenumeration#1{%
  3897. \advance\itemno by -1
  3898. \doitemize{#1.}\flushcr
  3899. }
  3900. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  3901. % to @enumerate.
  3902. %
  3903. \def\alphaenumerate{\enumerate{a}}
  3904. \def\capsenumerate{\enumerate{A}}
  3905. \def\Ealphaenumerate{\Eenumerate}
  3906. \def\Ecapsenumerate{\Eenumerate}
  3907. % @multitable macros
  3908. % Amy Hendrickson, 8/18/94, 3/6/96
  3909. %
  3910. % @multitable ... @end multitable will make as many columns as desired.
  3911. % Contents of each column will wrap at width given in preamble. Width
  3912. % can be specified either with sample text given in a template line,
  3913. % or in percent of \hsize, the current width of text on page.
  3914. % Table can continue over pages but will only break between lines.
  3915. % To make preamble:
  3916. %
  3917. % Either define widths of columns in terms of percent of \hsize:
  3918. % @multitable @columnfractions .25 .3 .45
  3919. % @item ...
  3920. %
  3921. % Numbers following @columnfractions are the percent of the total
  3922. % current hsize to be used for each column. You may use as many
  3923. % columns as desired.
  3924. % Or use a template:
  3925. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  3926. % @item ...
  3927. % using the widest term desired in each column.
  3928. % Each new table line starts with @item, each subsequent new column
  3929. % starts with @tab. Empty columns may be produced by supplying @tab's
  3930. % with nothing between them for as many times as empty columns are needed,
  3931. % ie, @tab@tab@tab will produce two empty columns.
  3932. % @item, @tab do not need to be on their own lines, but it will not hurt
  3933. % if they are.
  3934. % Sample multitable:
  3935. % @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  3936. % @item first col stuff @tab second col stuff @tab third col
  3937. % @item
  3938. % first col stuff
  3939. % @tab
  3940. % second col stuff
  3941. % @tab
  3942. % third col
  3943. % @item first col stuff @tab second col stuff
  3944. % @tab Many paragraphs of text may be used in any column.
  3945. %
  3946. % They will wrap at the width determined by the template.
  3947. % @item@tab@tab This will be in third column.
  3948. % @end multitable
  3949. % Default dimensions may be reset by user.
  3950. % @multitableparskip is vertical space between paragraphs in table.
  3951. % @multitableparindent is paragraph indent in table.
  3952. % @multitablecolmargin is horizontal space to be left between columns.
  3953. % @multitablelinespace is space to leave between table items, baseline
  3954. % to baseline.
  3955. % 0pt means it depends on current normal line spacing.
  3956. %
  3957. \newskip\multitableparskip
  3958. \newskip\multitableparindent
  3959. \newdimen\multitablecolspace
  3960. \newskip\multitablelinespace
  3961. \multitableparskip=0pt
  3962. \multitableparindent=6pt
  3963. \multitablecolspace=12pt
  3964. \multitablelinespace=0pt
  3965. % Macros used to set up halign preamble:
  3966. %
  3967. \let\endsetuptable\relax
  3968. \def\xendsetuptable{\endsetuptable}
  3969. \let\columnfractions\relax
  3970. \def\xcolumnfractions{\columnfractions}
  3971. \newif\ifsetpercent
  3972. % #1 is the @columnfraction, usually a decimal number like .5, but might
  3973. % be just 1. We just use it, whatever it is.
  3974. %
  3975. \def\pickupwholefraction#1 {%
  3976. \global\advance\colcount by 1
  3977. \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}%
  3978. \setuptable
  3979. }
  3980. \newcount\colcount
  3981. \def\setuptable#1{%
  3982. \def\firstarg{#1}%
  3983. \ifx\firstarg\xendsetuptable
  3984. \let\go = \relax
  3985. \else
  3986. \ifx\firstarg\xcolumnfractions
  3987. \global\setpercenttrue
  3988. \else
  3989. \ifsetpercent
  3990. \let\go\pickupwholefraction
  3991. \else
  3992. \global\advance\colcount by 1
  3993. \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a
  3994. % separator; typically that is always in the input, anyway.
  3995. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  3996. \fi
  3997. \fi
  3998. \ifx\go\pickupwholefraction
  3999. % Put the argument back for the \pickupwholefraction call, so
  4000. % we'll always have a period there to be parsed.
  4001. \def\go{\pickupwholefraction#1}%
  4002. \else
  4003. \let\go = \setuptable
  4004. \fi%
  4005. \fi
  4006. \go
  4007. }
  4008. % multitable-only commands.
  4009. %
  4010. % @headitem starts a heading row, which we typeset in bold. Assignments
  4011. % have to be global since we are inside the implicit group of an
  4012. % alignment entry. \everycr below resets \everytab so we don't have to
  4013. % undo it ourselves.
  4014. \def\headitemfont{\b}% for people to use in the template row; not changeable
  4015. \def\headitem{%
  4016. \checkenv\multitable
  4017. \crcr
  4018. \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings
  4019. \global\everytab={\bf}% can't use \headitemfont since the parsing differs
  4020. \the\everytab % for the first item
  4021. }%
  4022. %
  4023. % default for tables with no headings.
  4024. \let\headitemcrhook=\relax
  4025. %
  4026. % A \tab used to include \hskip1sp. But then the space in a template
  4027. % line is not enough. That is bad. So let's go back to just `&' until
  4028. % we again encounter the problem the 1sp was intended to solve.
  4029. % --karl, nathan@acm.org, 20apr99.
  4030. \def\tab{\checkenv\multitable &\the\everytab}%
  4031. % @multitable ... @end multitable definitions:
  4032. %
  4033. \newtoks\everytab % insert after every tab.
  4034. %
  4035. \envdef\multitable{%
  4036. \vskip\parskip
  4037. \startsavinginserts
  4038. %
  4039. % @item within a multitable starts a normal row.
  4040. % We use \def instead of \let so that if one of the multitable entries
  4041. % contains an @itemize, we don't choke on the \item (seen as \crcr aka
  4042. % \endtemplate) expanding \doitemize.
  4043. \def\item{\crcr}%
  4044. %
  4045. \tolerance=9500
  4046. \hbadness=9500
  4047. \setmultitablespacing
  4048. \parskip=\multitableparskip
  4049. \parindent=\multitableparindent
  4050. \overfullrule=0pt
  4051. \global\colcount=0
  4052. %
  4053. \everycr = {%
  4054. \noalign{%
  4055. \global\everytab={}% Reset from possible headitem.
  4056. \global\colcount=0 % Reset the column counter.
  4057. %
  4058. % Check for saved footnotes, etc.:
  4059. \checkinserts
  4060. %
  4061. % Perhaps a \nobreak, then reset:
  4062. \headitemcrhook
  4063. \global\let\headitemcrhook=\relax
  4064. }%
  4065. }%
  4066. %
  4067. \parsearg\domultitable
  4068. }
  4069. \def\domultitable#1{%
  4070. % To parse everything between @multitable and @item:
  4071. \setuptable#1 \endsetuptable
  4072. %
  4073. % This preamble sets up a generic column definition, which will
  4074. % be used as many times as user calls for columns.
  4075. % \vtop will set a single line and will also let text wrap and
  4076. % continue for many paragraphs if desired.
  4077. \halign\bgroup &%
  4078. \global\advance\colcount by 1
  4079. \multistrut
  4080. \vtop{%
  4081. % Use the current \colcount to find the correct column width:
  4082. \hsize=\expandafter\csname col\the\colcount\endcsname
  4083. %
  4084. % In order to keep entries from bumping into each other
  4085. % we will add a \leftskip of \multitablecolspace to all columns after
  4086. % the first one.
  4087. %
  4088. % If a template has been used, we will add \multitablecolspace
  4089. % to the width of each template entry.
  4090. %
  4091. % If the user has set preamble in terms of percent of \hsize we will
  4092. % use that dimension as the width of the column, and the \leftskip
  4093. % will keep entries from bumping into each other. Table will start at
  4094. % left margin and final column will justify at right margin.
  4095. %
  4096. % Make sure we don't inherit \rightskip from the outer environment.
  4097. \rightskip=0pt
  4098. \ifnum\colcount=1
  4099. % The first column will be indented with the surrounding text.
  4100. \advance\hsize by\leftskip
  4101. \else
  4102. \ifsetpercent \else
  4103. % If user has not set preamble in terms of percent of \hsize
  4104. % we will advance \hsize by \multitablecolspace.
  4105. \advance\hsize by \multitablecolspace
  4106. \fi
  4107. % In either case we will make \leftskip=\multitablecolspace:
  4108. \leftskip=\multitablecolspace
  4109. \fi
  4110. % Ignoring space at the beginning and end avoids an occasional spurious
  4111. % blank line, when TeX decides to break the line at the space before the
  4112. % box from the multistrut, so the strut ends up on a line by itself.
  4113. % For example:
  4114. % @multitable @columnfractions .11 .89
  4115. % @item @code{#}
  4116. % @tab Legal holiday which is valid in major parts of the whole country.
  4117. % Is automatically provided with highlighting sequences respectively
  4118. % marking characters.
  4119. \noindent\ignorespaces##\unskip\multistrut
  4120. }\cr
  4121. }
  4122. \def\Emultitable{%
  4123. \crcr
  4124. \egroup % end the \halign
  4125. \global\setpercentfalse
  4126. }
  4127. \def\setmultitablespacing{%
  4128. \def\multistrut{\strut}% just use the standard line spacing
  4129. %
  4130. % Compute \multitablelinespace (if not defined by user) for use in
  4131. % \multitableparskip calculation. We used define \multistrut based on
  4132. % this, but (ironically) that caused the spacing to be off.
  4133. % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
  4134. \ifdim\multitablelinespace=0pt
  4135. \setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
  4136. \global\advance\multitablelinespace by-\ht0
  4137. \fi
  4138. % Test to see if parskip is larger than space between lines of
  4139. % table. If not, do nothing.
  4140. % If so, set to same dimension as multitablelinespace.
  4141. \ifdim\multitableparskip>\multitablelinespace
  4142. \global\multitableparskip=\multitablelinespace
  4143. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4144. % than skip between lines in the table.
  4145. \fi%
  4146. \ifdim\multitableparskip=0pt
  4147. \global\multitableparskip=\multitablelinespace
  4148. \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
  4149. % than skip between lines in the table.
  4150. \fi}
  4151. \message{conditionals,}
  4152. % @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext,
  4153. % @ifnotxml always succeed. They currently do nothing; we don't
  4154. % attempt to check whether the conditionals are properly nested. But we
  4155. % have to remember that they are conditionals, so that @end doesn't
  4156. % attempt to close an environment group.
  4157. %
  4158. \def\makecond#1{%
  4159. \expandafter\let\csname #1\endcsname = \relax
  4160. \expandafter\let\csname iscond.#1\endcsname = 1
  4161. }
  4162. \makecond{iftex}
  4163. \makecond{ifnotdocbook}
  4164. \makecond{ifnothtml}
  4165. \makecond{ifnotinfo}
  4166. \makecond{ifnotplaintext}
  4167. \makecond{ifnotxml}
  4168. % Ignore @ignore, @ifhtml, @ifinfo, and the like.
  4169. %
  4170. \def\direntry{\doignore{direntry}}
  4171. \def\documentdescription{\doignore{documentdescription}}
  4172. \def\docbook{\doignore{docbook}}
  4173. \def\html{\doignore{html}}
  4174. \def\ifdocbook{\doignore{ifdocbook}}
  4175. \def\ifhtml{\doignore{ifhtml}}
  4176. \def\ifinfo{\doignore{ifinfo}}
  4177. \def\ifnottex{\doignore{ifnottex}}
  4178. \def\ifplaintext{\doignore{ifplaintext}}
  4179. \def\ifxml{\doignore{ifxml}}
  4180. \def\ignore{\doignore{ignore}}
  4181. \def\menu{\doignore{menu}}
  4182. \def\xml{\doignore{xml}}
  4183. % Ignore text until a line `@end #1', keeping track of nested conditionals.
  4184. %
  4185. % A count to remember the depth of nesting.
  4186. \newcount\doignorecount
  4187. \def\doignore#1{\begingroup
  4188. % Scan in ``verbatim'' mode:
  4189. \obeylines
  4190. \catcode`\@ = \other
  4191. \catcode`\{ = \other
  4192. \catcode`\} = \other
  4193. %
  4194. % Make sure that spaces turn into tokens that match what \doignoretext wants.
  4195. \spaceisspace
  4196. %
  4197. % Count number of #1's that we've seen.
  4198. \doignorecount = 0
  4199. %
  4200. % Swallow text until we reach the matching `@end #1'.
  4201. \dodoignore{#1}%
  4202. }
  4203. { \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source.
  4204. \obeylines %
  4205. %
  4206. \gdef\dodoignore#1{%
  4207. % #1 contains the command name as a string, e.g., `ifinfo'.
  4208. %
  4209. % Define a command to find the next `@end #1'.
  4210. \long\def\doignoretext##1^^M@end #1{%
  4211. \doignoretextyyy##1^^M@#1\_STOP_}%
  4212. %
  4213. % And this command to find another #1 command, at the beginning of a
  4214. % line. (Otherwise, we would consider a line `@c @ifset', for
  4215. % example, to count as an @ifset for nesting.)
  4216. \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}%
  4217. %
  4218. % And now expand that command.
  4219. \doignoretext ^^M%
  4220. }%
  4221. }
  4222. \def\doignoreyyy#1{%
  4223. \def\temp{#1}%
  4224. \ifx\temp\empty % Nothing found.
  4225. \let\next\doignoretextzzz
  4226. \else % Found a nested condition, ...
  4227. \advance\doignorecount by 1
  4228. \let\next\doignoretextyyy % ..., look for another.
  4229. % If we're here, #1 ends with ^^M\ifinfo (for example).
  4230. \fi
  4231. \next #1% the token \_STOP_ is present just after this macro.
  4232. }
  4233. % We have to swallow the remaining "\_STOP_".
  4234. %
  4235. \def\doignoretextzzz#1{%
  4236. \ifnum\doignorecount = 0 % We have just found the outermost @end.
  4237. \let\next\enddoignore
  4238. \else % Still inside a nested condition.
  4239. \advance\doignorecount by -1
  4240. \let\next\doignoretext % Look for the next @end.
  4241. \fi
  4242. \next
  4243. }
  4244. % Finish off ignored text.
  4245. { \obeylines%
  4246. % Ignore anything after the last `@end #1'; this matters in verbatim
  4247. % environments, where otherwise the newline after an ignored conditional
  4248. % would result in a blank line in the output.
  4249. \gdef\enddoignore#1^^M{\endgroup\ignorespaces}%
  4250. }
  4251. % @set VAR sets the variable VAR to an empty value.
  4252. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  4253. %
  4254. % Since we want to separate VAR from REST-OF-LINE (which might be
  4255. % empty), we can't just use \parsearg; we have to insert a space of our
  4256. % own to delimit the rest of the line, and then take it out again if we
  4257. % didn't need it.
  4258. % We rely on the fact that \parsearg sets \catcode`\ =10.
  4259. %
  4260. \parseargdef\set{\setyyy#1 \endsetyyy}
  4261. \def\setyyy#1 #2\endsetyyy{%
  4262. {%
  4263. \makevalueexpandable
  4264. \def\temp{#2}%
  4265. \edef\next{\gdef\makecsname{SET#1}}%
  4266. \ifx\temp\empty
  4267. \next{}%
  4268. \else
  4269. \setzzz#2\endsetzzz
  4270. \fi
  4271. }%
  4272. }
  4273. % Remove the trailing space \setxxx inserted.
  4274. \def\setzzz#1 \endsetzzz{\next{#1}}
  4275. % @clear VAR clears (i.e., unsets) the variable VAR.
  4276. %
  4277. \parseargdef\clear{%
  4278. {%
  4279. \makevalueexpandable
  4280. \global\expandafter\let\csname SET#1\endcsname=\relax
  4281. }%
  4282. }
  4283. % @value{foo} gets the text saved in variable foo.
  4284. \def\value{\begingroup\makevalueexpandable\valuexxx}
  4285. \def\valuexxx#1{\expandablevalue{#1}\endgroup}
  4286. {
  4287. \catcode`\-=\active \catcode`\_=\active
  4288. %
  4289. \gdef\makevalueexpandable{%
  4290. \let\value = \expandablevalue
  4291. % We don't want these characters active, ...
  4292. \catcode`\-=\other \catcode`\_=\other
  4293. % ..., but we might end up with active ones in the argument if
  4294. % we're called from @code, as @code{@value{foo-bar_}}, though.
  4295. % So \let them to their normal equivalents.
  4296. \let-\normaldash \let_\normalunderscore
  4297. }
  4298. }
  4299. % We have this subroutine so that we can handle at least some @value's
  4300. % properly in indexes (we call \makevalueexpandable in \indexdummies).
  4301. % The command has to be fully expandable (if the variable is set), since
  4302. % the result winds up in the index file. This means that if the
  4303. % variable's value contains other Texinfo commands, it's almost certain
  4304. % it will fail (although perhaps we could fix that with sufficient work
  4305. % to do a one-level expansion on the result, instead of complete).
  4306. %
  4307. % Unfortunately, this has the consequence that when _ is in the *value*
  4308. % of an @set, it does not print properly in the roman fonts (get the cmr
  4309. % dot accent at position 126 instead). No fix comes to mind, and it's
  4310. % been this way since 2003 or earlier, so just ignore it.
  4311. %
  4312. \def\expandablevalue#1{%
  4313. \expandafter\ifx\csname SET#1\endcsname\relax
  4314. {[No value for ``#1'']}%
  4315. \message{Variable `#1', used in @value, is not set.}%
  4316. \else
  4317. \csname SET#1\endcsname
  4318. \fi
  4319. }
  4320. % Like \expandablevalue, but completely expandable (the \message in the
  4321. % definition above operates at the execution level of TeX). Used when
  4322. % writing to auxiliary files, due to the expansion that \write does.
  4323. % If flag is undefined, pass through an unexpanded @value command: maybe it
  4324. % will be set by the time it is read back in.
  4325. %
  4326. % NB flag names containing - or _ may not work here.
  4327. \def\dummyvalue#1{%
  4328. \expandafter\ifx\csname SET#1\endcsname\relax
  4329. \noexpand\value{#1}%
  4330. \else
  4331. \csname SET#1\endcsname
  4332. \fi
  4333. }
  4334. % Used for @value's in index entries to form the sort key: expand the @value
  4335. % if possible, otherwise sort late.
  4336. \def\indexnofontsvalue#1{%
  4337. \expandafter\ifx\csname SET#1\endcsname\relax
  4338. ZZZZZZZ
  4339. \else
  4340. \csname SET#1\endcsname
  4341. \fi
  4342. }
  4343. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  4344. % with @set.
  4345. %
  4346. % To get the special treatment we need for `@end ifset,' we call
  4347. % \makecond and then redefine.
  4348. %
  4349. \makecond{ifset}
  4350. \def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}}
  4351. \def\doifset#1#2{%
  4352. {%
  4353. \makevalueexpandable
  4354. \let\next=\empty
  4355. \expandafter\ifx\csname SET#2\endcsname\relax
  4356. #1% If not set, redefine \next.
  4357. \fi
  4358. \expandafter
  4359. }\next
  4360. }
  4361. \def\ifsetfail{\doignore{ifset}}
  4362. % @ifclear VAR ... @end executes the `...' iff VAR has never been
  4363. % defined with @set, or has been undefined with @clear.
  4364. %
  4365. % The `\else' inside the `\doifset' parameter is a trick to reuse the
  4366. % above code: if the variable is not set, do nothing, if it is set,
  4367. % then redefine \next to \ifclearfail.
  4368. %
  4369. \makecond{ifclear}
  4370. \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
  4371. \def\ifclearfail{\doignore{ifclear}}
  4372. % @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
  4373. % without the @) is in fact defined. We can only feasibly check at the
  4374. % TeX level, so something like `mathcode' is going to considered
  4375. % defined even though it is not a Texinfo command.
  4376. %
  4377. \makecond{ifcommanddefined}
  4378. \def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
  4379. %
  4380. \def\doifcmddefined#1#2{{%
  4381. \makevalueexpandable
  4382. \let\next=\empty
  4383. \expandafter\ifx\csname #2\endcsname\relax
  4384. #1% If not defined, \let\next as above.
  4385. \fi
  4386. \expandafter
  4387. }\next
  4388. }
  4389. \def\ifcmddefinedfail{\doignore{ifcommanddefined}}
  4390. % @ifcommandnotdefined CMD ... handled similar to @ifclear above.
  4391. \makecond{ifcommandnotdefined}
  4392. \def\ifcommandnotdefined{%
  4393. \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
  4394. \def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
  4395. % Set the `txicommandconditionals' variable, so documents have a way to
  4396. % test if the @ifcommand...defined conditionals are available.
  4397. \set txicommandconditionals
  4398. % @dircategory CATEGORY -- specify a category of the dir file
  4399. % which this file should belong to. Ignore this in TeX.
  4400. \let\dircategory=\comment
  4401. % @defininfoenclose.
  4402. \let\definfoenclose=\comment
  4403. \message{indexing,}
  4404. % Index generation facilities
  4405. % Define \newwrite to be identical to plain tex's \newwrite
  4406. % except not \outer, so it can be used within macros and \if's.
  4407. \edef\newwrite{\makecsname{ptexnewwrite}}
  4408. % \newindex {foo} defines an index named IX.
  4409. % It automatically defines \IXindex such that
  4410. % \IXindex ...rest of line... puts an entry in the index IX.
  4411. % It also defines \IXindfile to be the number of the output channel for
  4412. % the file that accumulates this index. The file's extension is IX.
  4413. % The name of an index should be no more than 2 characters long
  4414. % for the sake of vms.
  4415. %
  4416. \def\newindex#1{%
  4417. \expandafter\chardef\csname#1indfile\endcsname=0
  4418. \expandafter\xdef\csname#1index\endcsname{% % Define @#1index
  4419. \noexpand\doindex{#1}}
  4420. }
  4421. % @defindex foo == \newindex{foo}
  4422. %
  4423. \def\defindex{\parsearg\newindex}
  4424. % Define @defcodeindex, like @defindex except put all entries in @code.
  4425. %
  4426. \def\defcodeindex{\parsearg\newcodeindex}
  4427. %
  4428. \def\newcodeindex#1{%
  4429. \expandafter\chardef\csname#1indfile\endcsname=0
  4430. \expandafter\xdef\csname#1index\endcsname{%
  4431. \noexpand\docodeindex{#1}}%
  4432. }
  4433. % The default indices:
  4434. \newindex{cp}% concepts,
  4435. \newcodeindex{fn}% functions,
  4436. \newcodeindex{vr}% variables,
  4437. \newcodeindex{tp}% types,
  4438. \newcodeindex{ky}% keys
  4439. \newcodeindex{pg}% and programs.
  4440. % @synindex foo bar makes index foo feed into index bar.
  4441. % Do this instead of @defindex foo if you don't want it as a separate index.
  4442. %
  4443. % @syncodeindex foo bar similar, but put all entries made for index foo
  4444. % inside @code.
  4445. %
  4446. \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}}
  4447. \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}}
  4448. % #1 is \doindex or \docodeindex, #2 the index getting redefined (foo),
  4449. % #3 the target index (bar).
  4450. \def\dosynindex#1#2#3{%
  4451. \requireopenindexfile{#3}%
  4452. % redefine \fooindfile:
  4453. \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname
  4454. \expandafter\let\csname#2indfile\endcsname=\temp
  4455. % redefine \fooindex:
  4456. \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}%
  4457. }
  4458. % Define \doindex, the driver for all index macros.
  4459. % Argument #1 is generated by the calling \fooindex macro,
  4460. % and it is the two-letter name of the index.
  4461. \def\doindex#1{\edef\indexname{#1}\parsearg\doindexxxx}
  4462. \def\doindexxxx #1{\doind{\indexname}{#1}}
  4463. % like the previous two, but they put @code around the argument.
  4464. \def\docodeindex#1{\edef\indexname{#1}\parsearg\docodeindexxxx}
  4465. \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
  4466. % Used when writing an index entry out to an index file to prevent
  4467. % expansion of Texinfo commands that can appear in an index entry.
  4468. %
  4469. \def\indexdummies{%
  4470. \escapechar = `\\ % use backslash in output files.
  4471. \definedummyletter\@%
  4472. \definedummyletter\ %
  4473. %
  4474. % For texindex which always views { and } as separators.
  4475. \def\{{\lbracechar{}}%
  4476. \def\}{\rbracechar{}}%
  4477. %
  4478. % Do the redefinitions.
  4479. \definedummies
  4480. }
  4481. % Used for the aux and toc files, where @ is the escape character.
  4482. %
  4483. \def\atdummies{%
  4484. \definedummyletter\@%
  4485. \definedummyletter\ %
  4486. \definedummyletter\{%
  4487. \definedummyletter\}%
  4488. %
  4489. % Do the redefinitions.
  4490. \definedummies
  4491. \otherbackslash
  4492. }
  4493. % \definedummyword defines \#1 as \string\#1\space, thus effectively
  4494. % preventing its expansion. This is used only for control words,
  4495. % not control letters, because the \space would be incorrect for
  4496. % control characters, but is needed to separate the control word
  4497. % from whatever follows.
  4498. %
  4499. % These can be used both for control words that take an argument and
  4500. % those that do not. If it is followed by {arg} in the input, then
  4501. % that will dutifully get written to the index (or wherever).
  4502. %
  4503. % For control letters, we have \definedummyletter, which omits the
  4504. % space.
  4505. %
  4506. \def\definedummyword #1{\def#1{\string#1\space}}%
  4507. \def\definedummyletter#1{\def#1{\string#1}}%
  4508. \let\definedummyaccent\definedummyletter
  4509. % Called from \indexdummies and \atdummies, to effectively prevent
  4510. % the expansion of commands.
  4511. %
  4512. \def\definedummies{%
  4513. %
  4514. \let\commondummyword\definedummyword
  4515. \let\commondummyletter\definedummyletter
  4516. \let\commondummyaccent\definedummyaccent
  4517. \commondummiesnofonts
  4518. %
  4519. \definedummyletter\_%
  4520. \definedummyletter\-%
  4521. %
  4522. % Non-English letters.
  4523. \definedummyword\AA
  4524. \definedummyword\AE
  4525. \definedummyword\DH
  4526. \definedummyword\L
  4527. \definedummyword\O
  4528. \definedummyword\OE
  4529. \definedummyword\TH
  4530. \definedummyword\aa
  4531. \definedummyword\ae
  4532. \definedummyword\dh
  4533. \definedummyword\exclamdown
  4534. \definedummyword\l
  4535. \definedummyword\o
  4536. \definedummyword\oe
  4537. \definedummyword\ordf
  4538. \definedummyword\ordm
  4539. \definedummyword\questiondown
  4540. \definedummyword\ss
  4541. \definedummyword\th
  4542. %
  4543. % Although these internal commands shouldn't show up, sometimes they do.
  4544. \definedummyword\bf
  4545. \definedummyword\gtr
  4546. \definedummyword\hat
  4547. \definedummyword\less
  4548. \definedummyword\sf
  4549. \definedummyword\sl
  4550. \definedummyword\tclose
  4551. \definedummyword\tt
  4552. %
  4553. \definedummyword\LaTeX
  4554. \definedummyword\TeX
  4555. %
  4556. % Assorted special characters.
  4557. \definedummyword\atchar
  4558. \definedummyword\arrow
  4559. \definedummyword\bullet
  4560. \definedummyword\comma
  4561. \definedummyword\copyright
  4562. \definedummyword\registeredsymbol
  4563. \definedummyword\dots
  4564. \definedummyword\enddots
  4565. \definedummyword\entrybreak
  4566. \definedummyword\equiv
  4567. \definedummyword\error
  4568. \definedummyword\euro
  4569. \definedummyword\expansion
  4570. \definedummyword\geq
  4571. \definedummyword\guillemetleft
  4572. \definedummyword\guillemetright
  4573. \definedummyword\guilsinglleft
  4574. \definedummyword\guilsinglright
  4575. \definedummyword\lbracechar
  4576. \definedummyword\leq
  4577. \definedummyword\mathopsup
  4578. \definedummyword\minus
  4579. \definedummyword\ogonek
  4580. \definedummyword\pounds
  4581. \definedummyword\point
  4582. \definedummyword\print
  4583. \definedummyword\quotedblbase
  4584. \definedummyword\quotedblleft
  4585. \definedummyword\quotedblright
  4586. \definedummyword\quoteleft
  4587. \definedummyword\quoteright
  4588. \definedummyword\quotesinglbase
  4589. \definedummyword\rbracechar
  4590. \definedummyword\result
  4591. \definedummyword\sub
  4592. \definedummyword\sup
  4593. \definedummyword\textdegree
  4594. %
  4595. % We want to disable all macros so that they are not expanded by \write.
  4596. \macrolist
  4597. \let\value\dummyvalue
  4598. %
  4599. \normalturnoffactive
  4600. }
  4601. % \commondummiesnofonts: common to \definedummies and \indexnofonts.
  4602. % Define \commondummyletter, \commondummyaccent and \commondummyword before
  4603. % using. Used for accents, font commands, and various control letters.
  4604. %
  4605. \def\commondummiesnofonts{%
  4606. % Control letters and accents.
  4607. \commondummyletter\!%
  4608. \commondummyaccent\"%
  4609. \commondummyaccent\'%
  4610. \commondummyletter\*%
  4611. \commondummyaccent\,%
  4612. \commondummyletter\.%
  4613. \commondummyletter\/%
  4614. \commondummyletter\:%
  4615. \commondummyaccent\=%
  4616. \commondummyletter\?%
  4617. \commondummyaccent\^%
  4618. \commondummyaccent\`%
  4619. \commondummyaccent\~%
  4620. \commondummyword\u
  4621. \commondummyword\v
  4622. \commondummyword\H
  4623. \commondummyword\dotaccent
  4624. \commondummyword\ogonek
  4625. \commondummyword\ringaccent
  4626. \commondummyword\tieaccent
  4627. \commondummyword\ubaraccent
  4628. \commondummyword\udotaccent
  4629. \commondummyword\dotless
  4630. %
  4631. % Texinfo font commands.
  4632. \commondummyword\b
  4633. \commondummyword\i
  4634. \commondummyword\r
  4635. \commondummyword\sansserif
  4636. \commondummyword\sc
  4637. \commondummyword\slanted
  4638. \commondummyword\t
  4639. %
  4640. % Commands that take arguments.
  4641. \commondummyword\abbr
  4642. \commondummyword\acronym
  4643. \commondummyword\anchor
  4644. \commondummyword\cite
  4645. \commondummyword\code
  4646. \commondummyword\command
  4647. \commondummyword\dfn
  4648. \commondummyword\dmn
  4649. \commondummyword\email
  4650. \commondummyword\emph
  4651. \commondummyword\env
  4652. \commondummyword\file
  4653. \commondummyword\image
  4654. \commondummyword\indicateurl
  4655. \commondummyword\inforef
  4656. \commondummyword\kbd
  4657. \commondummyword\key
  4658. \commondummyword\math
  4659. \commondummyword\option
  4660. \commondummyword\pxref
  4661. \commondummyword\ref
  4662. \commondummyword\samp
  4663. \commondummyword\strong
  4664. \commondummyword\tie
  4665. \commondummyword\U
  4666. \commondummyword\uref
  4667. \commondummyword\url
  4668. \commondummyword\var
  4669. \commondummyword\verb
  4670. \commondummyword\w
  4671. \commondummyword\xref
  4672. }
  4673. % For testing: output @{ and @} in index sort strings as \{ and \}.
  4674. \newif\ifusebracesinindexes
  4675. \let\indexlbrace\relax
  4676. \let\indexrbrace\relax
  4677. {\catcode`\@=0
  4678. \catcode`\\=13
  4679. @gdef@backslashdisappear{@def\{}}
  4680. }
  4681. {
  4682. \catcode`\<=13
  4683. \catcode`\-=13
  4684. \catcode`\`=13
  4685. \gdef\indexnonalnumdisappear{%
  4686. \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax\else
  4687. % @set txiindexlquoteignore makes us ignore left quotes in the sort term.
  4688. % (Introduced for FSFS 2nd ed.)
  4689. \let`=\empty
  4690. \fi
  4691. %
  4692. \expandafter\ifx\csname SETtxiindexbackslashignore\endcsname\relax\else
  4693. \backslashdisappear
  4694. \fi
  4695. %
  4696. \expandafter\ifx\csname SETtxiindexhyphenignore\endcsname\relax\else
  4697. \def-{}%
  4698. \fi
  4699. \expandafter\ifx\csname SETtxiindexlessthanignore\endcsname\relax\else
  4700. \def<{}%
  4701. \fi
  4702. \expandafter\ifx\csname SETtxiindexatsignignore\endcsname\relax\else
  4703. \def\@{}%
  4704. \fi
  4705. }
  4706. \gdef\indexnonalnumreappear{%
  4707. \useindexbackslash
  4708. \let-\normaldash
  4709. \let<\normalless
  4710. \def\@{@}%
  4711. }
  4712. }
  4713. % \indexnofonts is used when outputting the strings to sort the index
  4714. % by, and when constructing control sequence names. It eliminates all
  4715. % control sequences and just writes whatever the best ASCII sort string
  4716. % would be for a given command (usually its argument).
  4717. %
  4718. \def\indexnofonts{%
  4719. % Accent commands should become @asis.
  4720. \def\commondummyaccent##1{\let##1\asis}%
  4721. % We can just ignore other control letters.
  4722. \def\commondummyletter##1{\let##1\empty}%
  4723. % All control words become @asis by default; overrides below.
  4724. \let\commondummyword\commondummyaccent
  4725. \commondummiesnofonts
  4726. %
  4727. % Don't no-op \tt, since it isn't a user-level command
  4728. % and is used in the definitions of the active chars like <, >, |, etc.
  4729. % Likewise with the other plain tex font commands.
  4730. %\let\tt=\asis
  4731. %
  4732. \def\ { }%
  4733. \def\@{@}%
  4734. \def\_{\normalunderscore}%
  4735. \def\-{}% @- shouldn't affect sorting
  4736. %
  4737. \uccode`\1=`\{ \uppercase{\def\{{1}}%
  4738. \uccode`\1=`\} \uppercase{\def\}{1}}%
  4739. \let\lbracechar\{%
  4740. \let\rbracechar\}%
  4741. %
  4742. % Non-English letters.
  4743. \def\AA{AA}%
  4744. \def\AE{AE}%
  4745. \def\DH{DZZ}%
  4746. \def\L{L}%
  4747. \def\OE{OE}%
  4748. \def\O{O}%
  4749. \def\TH{TH}%
  4750. \def\aa{aa}%
  4751. \def\ae{ae}%
  4752. \def\dh{dzz}%
  4753. \def\exclamdown{!}%
  4754. \def\l{l}%
  4755. \def\oe{oe}%
  4756. \def\ordf{a}%
  4757. \def\ordm{o}%
  4758. \def\o{o}%
  4759. \def\questiondown{?}%
  4760. \def\ss{ss}%
  4761. \def\th{th}%
  4762. %
  4763. \def\LaTeX{LaTeX}%
  4764. \def\TeX{TeX}%
  4765. %
  4766. % Assorted special characters. \defglyph gives the control sequence a
  4767. % definition that removes the {} that follows its use.
  4768. \defglyph\atchar{@}%
  4769. \defglyph\arrow{->}%
  4770. \defglyph\bullet{bullet}%
  4771. \defglyph\comma{,}%
  4772. \defglyph\copyright{copyright}%
  4773. \defglyph\dots{...}%
  4774. \defglyph\enddots{...}%
  4775. \defglyph\equiv{==}%
  4776. \defglyph\error{error}%
  4777. \defglyph\euro{euro}%
  4778. \defglyph\expansion{==>}%
  4779. \defglyph\geq{>=}%
  4780. \defglyph\guillemetleft{<<}%
  4781. \defglyph\guillemetright{>>}%
  4782. \defglyph\guilsinglleft{<}%
  4783. \defglyph\guilsinglright{>}%
  4784. \defglyph\leq{<=}%
  4785. \defglyph\lbracechar{\{}%
  4786. \defglyph\minus{-}%
  4787. \defglyph\point{.}%
  4788. \defglyph\pounds{pounds}%
  4789. \defglyph\print{-|}%
  4790. \defglyph\quotedblbase{"}%
  4791. \defglyph\quotedblleft{"}%
  4792. \defglyph\quotedblright{"}%
  4793. \defglyph\quoteleft{`}%
  4794. \defglyph\quoteright{'}%
  4795. \defglyph\quotesinglbase{,}%
  4796. \defglyph\rbracechar{\}}%
  4797. \defglyph\registeredsymbol{R}%
  4798. \defglyph\result{=>}%
  4799. \defglyph\textdegree{o}%
  4800. %
  4801. % We need to get rid of all macros, leaving only the arguments (if present).
  4802. % Of course this is not nearly correct, but it is the best we can do for now.
  4803. % makeinfo does not expand macros in the argument to @deffn, which ends up
  4804. % writing an index entry, and texindex isn't prepared for an index sort entry
  4805. % that starts with \.
  4806. %
  4807. % Since macro invocations are followed by braces, we can just redefine them
  4808. % to take a single TeX argument. The case of a macro invocation that
  4809. % goes to end-of-line is not handled.
  4810. %
  4811. \macrolist
  4812. \let\value\indexnofontsvalue
  4813. }
  4814. \def\defglyph#1#2{\def#1##1{#2}} % see above
  4815. \let\SETmarginindex=\relax % put index entries in margin (undocumented)?
  4816. % Most index entries go through here, but \dosubind is the general case.
  4817. % #1 is the index name, #2 is the entry text.
  4818. \def\doind#1#2{\dosubind{#1}{#2}{}}
  4819. % There is also \dosubind {index}{topic}{subtopic}
  4820. % which makes an entry in a two-level index such as the operation index.
  4821. % TODO: Two-level index? Operation index?
  4822. % Workhorse for all indexes.
  4823. % #1 is name of index, #2 is stuff to put there, #3 is subentry --
  4824. % empty if called from \doind, as we usually are (the main exception
  4825. % is with most defuns, which call us directly).
  4826. %
  4827. \def\dosubind#1#2#3{%
  4828. \iflinks
  4829. {%
  4830. \requireopenindexfile{#1}%
  4831. % Store the main index entry text (including the third arg).
  4832. \toks0 = {#2}%
  4833. % If third arg is present, precede it with a space.
  4834. \def\thirdarg{#3}%
  4835. \ifx\thirdarg\empty \else
  4836. \toks0 = \expandafter{\the\toks0 \space #3}%
  4837. \fi
  4838. %
  4839. \edef\writeto{\csname#1indfile\endcsname}%
  4840. %
  4841. \safewhatsit\dosubindwrite
  4842. }%
  4843. \fi
  4844. }
  4845. % Check if an index file has been opened, and if not, open it.
  4846. \def\requireopenindexfile#1{%
  4847. \ifnum\csname #1indfile\endcsname=0
  4848. \expandafter\newwrite \csname#1indfile\endcsname
  4849. \edef\suffix{#1}%
  4850. % A .fls suffix would conflict with the file extension for the output
  4851. % of -recorder, so use .f1s instead.
  4852. \ifx\suffix\indexisfl\def\suffix{f1}\fi
  4853. % Open the file
  4854. \immediate\openout\csname#1indfile\endcsname \jobname.\suffix
  4855. % Using \immediate above here prevents an object entering into the current
  4856. % box, which could confound checks such as those in \safewhatsit for
  4857. % preceding skips.
  4858. \typeout{Writing index file \jobname.\suffix}%
  4859. \fi}
  4860. \def\indexisfl{fl}
  4861. % Output \ as {\indexbackslash}, because \ is an escape character in
  4862. % the index files.
  4863. \let\indexbackslash=\relax
  4864. {\catcode`\@=0 \catcode`\\=\active
  4865. @gdef@useindexbackslash{@def\{{@indexbackslash}}}
  4866. }
  4867. % Definition for writing index entry text.
  4868. \def\sortas#1{\ignorespaces}%
  4869. % Definition for writing index entry sort key. Should occur at the at
  4870. % the beginning of the index entry, like
  4871. % @cindex @sortas{september} \september
  4872. % The \ignorespaces takes care of following space, but there's no way
  4873. % to remove space before it.
  4874. {
  4875. \catcode`\-=13
  4876. \gdef\indexwritesortas{%
  4877. \begingroup
  4878. \indexnonalnumreappear
  4879. \indexwritesortasxxx}
  4880. \gdef\indexwritesortasxxx#1{%
  4881. \xdef\indexsortkey{#1}\endgroup}
  4882. }
  4883. % Write the entry in \toks0 to the index file.
  4884. %
  4885. \def\dosubindwrite{%
  4886. % Put the index entry in the margin if desired.
  4887. \ifx\SETmarginindex\relax\else
  4888. \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
  4889. \fi
  4890. %
  4891. % Remember, we are within a group.
  4892. \indexdummies % Must do this here, since \bf, etc expand at this stage
  4893. \useindexbackslash % \indexbackslash isn't defined now so it will be output
  4894. % as is; and it will print as backslash.
  4895. % The braces around \indexbrace are recognized by texindex.
  4896. %
  4897. % Get the string to sort by, by processing the index entry with all
  4898. % font commands turned off.
  4899. {\indexnofonts
  4900. \def\lbracechar{{\indexlbrace}}%
  4901. \def\rbracechar{{\indexrbrace}}%
  4902. \let\{=\lbracechar
  4903. \let\}=\rbracechar
  4904. \indexnonalnumdisappear
  4905. \xdef\indexsortkey{}%
  4906. \let\sortas=\indexwritesortas
  4907. \edef\temp{\the\toks0}%
  4908. \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
  4909. \ifx\indexsortkey\empty
  4910. \xdef\indexsortkey{\temp}%
  4911. \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
  4912. \fi
  4913. }%
  4914. %
  4915. % Set up the complete index entry, with both the sort key and
  4916. % the original text, including any font commands. We write
  4917. % three arguments to \entry to the .?? file (four in the
  4918. % subentry case), texindex reduces to two when writing the .??s
  4919. % sorted result.
  4920. \edef\temp{%
  4921. \write\writeto{%
  4922. \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
  4923. }%
  4924. \temp
  4925. }
  4926. \newbox\dummybox % used above
  4927. % Take care of unwanted page breaks/skips around a whatsit:
  4928. %
  4929. % If a skip is the last thing on the list now, preserve it
  4930. % by backing up by \lastskip, doing the \write, then inserting
  4931. % the skip again. Otherwise, the whatsit generated by the
  4932. % \write or \pdfdest will make \lastskip zero. The result is that
  4933. % sequences like this:
  4934. % @end defun
  4935. % @tindex whatever
  4936. % @defun ...
  4937. % will have extra space inserted, because the \medbreak in the
  4938. % start of the @defun won't see the skip inserted by the @end of
  4939. % the previous defun.
  4940. %
  4941. % But don't do any of this if we're not in vertical mode. We
  4942. % don't want to do a \vskip and prematurely end a paragraph.
  4943. %
  4944. % Avoid page breaks due to these extra skips, too.
  4945. %
  4946. % But wait, there is a catch there:
  4947. % We'll have to check whether \lastskip is zero skip. \ifdim is not
  4948. % sufficient for this purpose, as it ignores stretch and shrink parts
  4949. % of the skip. The only way seems to be to check the textual
  4950. % representation of the skip.
  4951. %
  4952. % The following is almost like \def\zeroskipmacro{0.0pt} except that
  4953. % the ``p'' and ``t'' characters have catcode \other, not 11 (letter).
  4954. %
  4955. \edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname}
  4956. %
  4957. \newskip\whatsitskip
  4958. \newcount\whatsitpenalty
  4959. %
  4960. % ..., ready, GO:
  4961. %
  4962. \def\safewhatsit#1{\ifhmode
  4963. #1%
  4964. \else
  4965. % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
  4966. \whatsitskip = \lastskip
  4967. \edef\lastskipmacro{\the\lastskip}%
  4968. \whatsitpenalty = \lastpenalty
  4969. %
  4970. % If \lastskip is nonzero, that means the last item was a
  4971. % skip. And since a skip is discardable, that means this
  4972. % -\whatsitskip glue we're inserting is preceded by a
  4973. % non-discardable item, therefore it is not a potential
  4974. % breakpoint, therefore no \nobreak needed.
  4975. \ifx\lastskipmacro\zeroskipmacro
  4976. \else
  4977. \vskip-\whatsitskip
  4978. \fi
  4979. %
  4980. #1%
  4981. %
  4982. \ifx\lastskipmacro\zeroskipmacro
  4983. % If \lastskip was zero, perhaps the last item was a penalty, and
  4984. % perhaps it was >=10000, e.g., a \nobreak. In that case, we want
  4985. % to re-insert the same penalty (values >10000 are used for various
  4986. % signals); since we just inserted a non-discardable item, any
  4987. % following glue (such as a \parskip) would be a breakpoint. For example:
  4988. % @deffn deffn-whatever
  4989. % @vindex index-whatever
  4990. % Description.
  4991. % would allow a break between the index-whatever whatsit
  4992. % and the "Description." paragraph.
  4993. \ifnum\whatsitpenalty>9999 \penalty\whatsitpenalty \fi
  4994. \else
  4995. % On the other hand, if we had a nonzero \lastskip,
  4996. % this make-up glue would be preceded by a non-discardable item
  4997. % (the whatsit from the \write), so we must insert a \nobreak.
  4998. \nobreak\vskip\whatsitskip
  4999. \fi
  5000. \fi}
  5001. % The index entry written in the file actually looks like
  5002. % \entry {sortstring}{page}{topic}
  5003. % or
  5004. % \entry {sortstring}{page}{topic}{subtopic}
  5005. % The texindex program reads in these files and writes files
  5006. % containing these kinds of lines:
  5007. % \initial {c}
  5008. % before the first topic whose initial is c
  5009. % \entry {topic}{pagelist}
  5010. % for a topic that is used without subtopics
  5011. % \primary {topic}
  5012. % for the beginning of a topic that is used with subtopics
  5013. % \secondary {subtopic}{pagelist}
  5014. % for each subtopic.
  5015. % Define the user-accessible indexing commands
  5016. % @findex, @vindex, @kindex, @cindex.
  5017. \def\findex {\fnindex}
  5018. \def\kindex {\kyindex}
  5019. \def\cindex {\cpindex}
  5020. \def\vindex {\vrindex}
  5021. \def\tindex {\tpindex}
  5022. \def\pindex {\pgindex}
  5023. \def\cindexsub {\begingroup\obeylines\cindexsub}
  5024. {\obeylines %
  5025. \gdef\cindexsub "#1" #2^^M{\endgroup %
  5026. \dosubind{cp}{#2}{#1}}}
  5027. % Define the macros used in formatting output of the sorted index material.
  5028. % @printindex causes a particular index (the ??s file) to get printed.
  5029. % It does not print any chapter heading (usually an @unnumbered).
  5030. %
  5031. \parseargdef\printindex{\begingroup
  5032. \dobreak \chapheadingskip{10000}%
  5033. %
  5034. \smallfonts \rm
  5035. \tolerance = 9500
  5036. \plainfrenchspacing
  5037. \everypar = {}% don't want the \kern\-parindent from indentation suppression.
  5038. %
  5039. % See if the index file exists and is nonempty.
  5040. % Change catcode of @ here so that if the index file contains
  5041. % \initial {@}
  5042. % as its first line, TeX doesn't complain about mismatched braces
  5043. % (because it thinks @} is a control sequence).
  5044. \catcode`\@ = 12
  5045. % See comment in \requireopenindexfile.
  5046. \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
  5047. \openin 1 \jobname.\indexname s
  5048. \ifeof 1
  5049. % \enddoublecolumns gets confused if there is no text in the index,
  5050. % and it loses the chapter title and the aux file entries for the
  5051. % index. The easiest way to prevent this problem is to make sure
  5052. % there is some text.
  5053. \putwordIndexNonexistent
  5054. \typeout{No file \jobname.\indexname s.}%
  5055. \else
  5056. \catcode`\\ = 0
  5057. %
  5058. % If the index file exists but is empty, then \openin leaves \ifeof
  5059. % false. We have to make TeX try to read something from the file, so
  5060. % it can discover if there is anything in it.
  5061. \read 1 to \thisline
  5062. \ifeof 1
  5063. \putwordIndexIsEmpty
  5064. \else
  5065. % Index files are almost Texinfo source, but we use \ as the escape
  5066. % character. It would be better to use @, but that's too big a change
  5067. % to make right now.
  5068. \def\indexbackslash{\ttbackslash}%
  5069. \let\indexlbrace\{ % Likewise, set these sequences for braces
  5070. \let\indexrbrace\} % used in the sort key.
  5071. \begindoublecolumns
  5072. \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
  5073. %
  5074. % Read input from the index file line by line.
  5075. \loopdo
  5076. \ifeof1 \else
  5077. \read 1 to \nextline
  5078. \fi
  5079. %
  5080. \indexinputprocessing
  5081. \thisline
  5082. %
  5083. \ifeof1\else
  5084. \let\thisline\nextline
  5085. \repeat
  5086. %%
  5087. \enddoublecolumns
  5088. \fi
  5089. \fi
  5090. \closein 1
  5091. \endgroup}
  5092. \def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
  5093. \def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
  5094. \def\indexinputprocessing{%
  5095. \ifeof1
  5096. \let\firsttoken\relax
  5097. \else
  5098. \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
  5099. \act
  5100. \fi
  5101. }
  5102. \def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
  5103. \long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
  5104. % These macros are used by the sorted index file itself.
  5105. % Change them to control the appearance of the index.
  5106. {\catcode`\/=13 \catcode`\-=13 \catcode`\^=13 \catcode`\~=13 \catcode`\_=13
  5107. \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
  5108. \catcode`\$=3
  5109. \gdef\initialglyphs{%
  5110. % Some changes for non-alphabetic characters. Using the glyphs from the
  5111. % math fonts looks more consistent than the typewriter font used elsewhere
  5112. % for these characters.
  5113. \def\indexbackslash{\math{\backslash}}%
  5114. \let\\=\indexbackslash
  5115. %
  5116. % Can't get bold backslash so don't use bold forward slash
  5117. \catcode`\/=13
  5118. \def/{{\secrmnotbold \normalslash}}%
  5119. \def-{{\normaldash\normaldash}}% en dash `--'
  5120. \def^{{\chapbf \normalcaret}}%
  5121. \def~{{\chapbf \normaltilde}}%
  5122. \def\_{%
  5123. \leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }%
  5124. \def|{$\vert$}%
  5125. \def<{$\less$}%
  5126. \def>{$\gtr$}%
  5127. \def+{$\normalplus$}%
  5128. }}
  5129. \def\initial{%
  5130. \bgroup
  5131. \initialglyphs
  5132. \initialx
  5133. }
  5134. \def\initialx#1{%
  5135. % Remove any glue we may have, we'll be inserting our own.
  5136. \removelastskip
  5137. %
  5138. % We like breaks before the index initials, so insert a bonus.
  5139. % The glue before the bonus allows a little bit of space at the
  5140. % bottom of a column to reduce an increase in inter-line spacing.
  5141. \nobreak
  5142. \vskip 0pt plus 5\baselineskip
  5143. \penalty -300
  5144. \vskip 0pt plus -5\baselineskip
  5145. %
  5146. % Typeset the initial. Making this add up to a whole number of
  5147. % baselineskips increases the chance of the dots lining up from column
  5148. % to column. It still won't often be perfect, because of the stretch
  5149. % we need before each entry, but it's better.
  5150. %
  5151. % No shrink because it confuses \balancecolumns.
  5152. \vskip 1.67\baselineskip plus 1\baselineskip
  5153. \leftline{\secfonts \kern-0.05em \secbf #1}%
  5154. % \secfonts is inside the argument of \leftline so that the change of
  5155. % \baselineskip will not affect any glue inserted before the vbox that
  5156. % \leftline creates.
  5157. % Do our best not to break after the initial.
  5158. \nobreak
  5159. \vskip .33\baselineskip plus .1\baselineskip
  5160. \egroup % \initialglyphs
  5161. }
  5162. \newdimen\entryrightmargin
  5163. \entryrightmargin=0pt
  5164. % \entry typesets a paragraph consisting of the text (#1), dot leaders, and
  5165. % then page number (#2) flushed to the right margin. It is used for index
  5166. % and table of contents entries. The paragraph is indented by \leftskip.
  5167. %
  5168. \def\entry{%
  5169. \begingroup
  5170. %
  5171. % For pdfTeX and XeTeX.
  5172. % The redefinition of \domark stops marks being added in \pdflink to
  5173. % preserve coloured links across page boundaries. Otherwise the marks
  5174. % would get in the way of \lastbox in \insertentrybox.
  5175. \let\domark\relax
  5176. %
  5177. % Start a new paragraph if necessary, so our assignments below can't
  5178. % affect previous text.
  5179. \par
  5180. %
  5181. % No extra space above this paragraph.
  5182. \parskip = 0in
  5183. %
  5184. % When reading the text of entry, convert explicit line breaks
  5185. % from @* into spaces. The user might give these in long section
  5186. % titles, for instance.
  5187. \def\*{\unskip\space\ignorespaces}%
  5188. \def\entrybreak{\hfil\break}% An undocumented command
  5189. %
  5190. % Swallow the left brace of the text (first parameter):
  5191. \afterassignment\doentry
  5192. \let\temp =
  5193. }
  5194. \def\entrybreak{\unskip\space\ignorespaces}%
  5195. \def\doentry{%
  5196. % Save the text of the entry
  5197. \global\setbox\boxA=\hbox\bgroup
  5198. \bgroup % Instead of the swallowed brace.
  5199. \noindent
  5200. \aftergroup\finishentry
  5201. % And now comes the text of the entry.
  5202. % Not absorbing as a macro argument reduces the chance of problems
  5203. % with catcodes occurring.
  5204. }
  5205. {\catcode`\@=11
  5206. \gdef\finishentry#1{%
  5207. \egroup % end box A
  5208. \dimen@ = \wd\boxA % Length of text of entry
  5209. \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
  5210. % #1 is the page number.
  5211. %
  5212. % Get the width of the page numbers, and only use
  5213. % leaders if they are present.
  5214. \global\setbox\boxB = \hbox{#1}%
  5215. \ifdim\wd\boxB = 0pt
  5216. \null\nobreak\hfill\ %
  5217. \else
  5218. %
  5219. \null\nobreak\indexdotfill % Have leaders before the page number.
  5220. %
  5221. \ifpdf
  5222. \pdfgettoks#1.%
  5223. \hskip\skip\thinshrinkable\the\toksA
  5224. \else
  5225. \ifx\XeTeXrevision\thisisundefined
  5226. \hskip\skip\thinshrinkable #1%
  5227. \else
  5228. \pdfgettoks#1.%
  5229. \hskip\skip\thinshrinkable\the\toksA
  5230. \fi
  5231. \fi
  5232. \fi
  5233. \egroup % end \boxA
  5234. \ifdim\wd\boxB = 0pt
  5235. \global\setbox\entrybox=\vbox{\unhbox\boxA}%
  5236. \else
  5237. \global\setbox\entrybox=\vbox\bgroup
  5238. % We want the text of the entries to be aligned to the left, and the
  5239. % page numbers to be aligned to the right.
  5240. %
  5241. \parindent = 0pt
  5242. \advance\leftskip by 0pt plus 1fil
  5243. \advance\leftskip by 0pt plus -1fill
  5244. \rightskip = 0pt plus -1fil
  5245. \advance\rightskip by 0pt plus 1fill
  5246. % Cause last line, which could consist of page numbers on their own
  5247. % if the list of page numbers is long, to be aligned to the right.
  5248. \parfillskip=0pt plus -1fill
  5249. %
  5250. \advance\rightskip by \entryrightmargin
  5251. % Determine how far we can stretch into the margin.
  5252. % This allows, e.g., "Appendix H GNU Free Documentation License" to
  5253. % fit on one line in @letterpaper format.
  5254. \ifdim\entryrightmargin>2.1em
  5255. \dimen@i=2.1em
  5256. \else
  5257. \dimen@i=0em
  5258. \fi
  5259. \advance \parfillskip by 0pt minus 1\dimen@i
  5260. %
  5261. \dimen@ii = \hsize
  5262. \advance\dimen@ii by -1\leftskip
  5263. \advance\dimen@ii by -1\entryrightmargin
  5264. \advance\dimen@ii by 1\dimen@i
  5265. \ifdim\wd\boxA > \dimen@ii % If the entry doesn't fit in one line
  5266. \ifdim\dimen@ > 0.8\dimen@ii % due to long index text
  5267. % Try to split the text roughly evenly. \dimen@ will be the length of
  5268. % the first line.
  5269. \dimen@ = 0.7\dimen@
  5270. \dimen@ii = \hsize
  5271. \ifnum\dimen@>\dimen@ii
  5272. % If the entry is too long (for example, if it needs more than
  5273. % two lines), use all the space in the first line.
  5274. \dimen@ = \dimen@ii
  5275. \fi
  5276. \advance\leftskip by 0pt plus 1fill % ragged right
  5277. \advance \dimen@ by 1\rightskip
  5278. \parshape = 2 0pt \dimen@ 0em \dimen@ii
  5279. % Ideally we'd add a finite glue at the end of the first line only,
  5280. % instead of using \parshape with explicit line lengths, but TeX
  5281. % doesn't seem to provide a way to do such a thing.
  5282. %
  5283. % Indent all lines but the first one.
  5284. \advance\leftskip by 1em
  5285. \advance\parindent by -1em
  5286. \fi\fi
  5287. \indent % start paragraph
  5288. \unhbox\boxA
  5289. %
  5290. % Do not prefer a separate line ending with a hyphen to fewer lines.
  5291. \finalhyphendemerits = 0
  5292. %
  5293. % Word spacing - no stretch
  5294. \spaceskip=\fontdimen2\font minus \fontdimen4\font
  5295. %
  5296. \linepenalty=1000 % Discourage line breaks.
  5297. \hyphenpenalty=5000 % Discourage hyphenation.
  5298. %
  5299. \par % format the paragraph
  5300. \egroup % The \vbox
  5301. \fi
  5302. \endgroup
  5303. \dotheinsertentrybox
  5304. }}
  5305. \newskip\thinshrinkable
  5306. \skip\thinshrinkable=.15em minus .15em
  5307. \newbox\entrybox
  5308. \def\insertentrybox{%
  5309. \ourunvbox\entrybox
  5310. }
  5311. % default definition
  5312. \let\dotheinsertentrybox\insertentrybox
  5313. % Use \lastbox to take apart vbox box by box, and add each sub-box
  5314. % to the current vertical list.
  5315. \def\ourunvbox#1{%
  5316. \bgroup % for local binding of \delayedbox
  5317. % Remove the last box from box #1
  5318. \global\setbox#1=\vbox{%
  5319. \unvbox#1%
  5320. \unskip % remove any glue
  5321. \unpenalty
  5322. \global\setbox\interbox=\lastbox
  5323. }%
  5324. \setbox\delayedbox=\box\interbox
  5325. \ifdim\ht#1=0pt\else
  5326. \ourunvbox#1 % Repeat on what's left of the box
  5327. \nobreak
  5328. \fi
  5329. \box\delayedbox
  5330. \egroup
  5331. }
  5332. \newbox\delayedbox
  5333. \newbox\interbox
  5334. % Used from \printindex. \firsttoken should be the first token
  5335. % after the \entry. If it's not another \entry, we are at the last
  5336. % line of a group of index entries, so insert a penalty to discourage
  5337. % widowed index entries.
  5338. \def\dotheinsertentryboxwithpenalty{%
  5339. \ifx\firsttoken\isentry
  5340. \else
  5341. \penalty 9000
  5342. \fi
  5343. \insertentrybox
  5344. }
  5345. \def\isentry{\entry}%
  5346. % Like plain.tex's \dotfill, except uses up at least 1 em.
  5347. % The filll stretch here overpowers both the fil and fill stretch to push
  5348. % the page number to the right.
  5349. \def\indexdotfill{\cleaders
  5350. \hbox{$\mathsurround=0pt \mkern1.5mu.\mkern1.5mu$}\hskip 1em plus 1filll}
  5351. \def\primary #1{\line{#1\hfil}}
  5352. \newskip\secondaryindent \secondaryindent=0.5cm
  5353. \def\secondary#1#2{{%
  5354. \parfillskip=0in
  5355. \parskip=0in
  5356. \hangindent=1in
  5357. \hangafter=1
  5358. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
  5359. \ifpdf
  5360. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5361. \else
  5362. \ifx\XeTeXrevision\thisisundefined
  5363. #2
  5364. \else
  5365. \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
  5366. \fi
  5367. \fi
  5368. \par
  5369. }}
  5370. % Define two-column mode, which we use to typeset indexes.
  5371. % Adapted from the TeXbook, page 416, which is to say,
  5372. % the manmac.tex format used to print the TeXbook itself.
  5373. \catcode`\@=11 % private names
  5374. \newbox\partialpage
  5375. \newdimen\doublecolumnhsize
  5376. % Use inside an output routine to save \topmark and \firstmark
  5377. \def\savemarks{%
  5378. \global\savedtopmark=\expandafter{\topmark }%
  5379. \global\savedfirstmark=\expandafter{\firstmark }%
  5380. }
  5381. \newtoks\savedtopmark
  5382. \newtoks\savedfirstmark
  5383. % Set \topmark and \firstmark for next time \output runs.
  5384. % Can't be run from withinside \output (because any material
  5385. % added while an output routine is active, including
  5386. % penalties, is saved for after it finishes). The page so far
  5387. % should be empty, otherwise what's on it will be thrown away.
  5388. \def\restoremarks{%
  5389. \mark{\the\savedtopmark}%
  5390. \bgroup\output = {%
  5391. \setbox\dummybox=\box\PAGE
  5392. }abc\eject\egroup
  5393. % "abc" because output routine doesn't fire for a completely empty page.
  5394. \mark{\the\savedfirstmark}%
  5395. }
  5396. \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
  5397. % If not much space left on page, start a new page.
  5398. \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
  5399. %
  5400. % Grab any single-column material above us.
  5401. \output = {%
  5402. %
  5403. % Here is a possibility not foreseen in manmac: if we accumulate a
  5404. % whole lot of material, we might end up calling this \output
  5405. % routine twice in a row (see the doublecol-lose test, which is
  5406. % essentially a couple of indexes with @setchapternewpage off). In
  5407. % that case we just ship out what is in \partialpage with the normal
  5408. % output routine. Generally, \partialpage will be empty when this
  5409. % runs and this will be a no-op. See the indexspread.tex test case.
  5410. \ifvoid\partialpage \else
  5411. \onepageout{\pagecontents\partialpage}%
  5412. \fi
  5413. %
  5414. \global\setbox\partialpage = \vbox{%
  5415. % Unvbox the main output page.
  5416. \unvbox\PAGE
  5417. \kern-\topskip \kern\baselineskip
  5418. }%
  5419. \savemarks
  5420. }%
  5421. \eject % run that output routine to set \partialpage
  5422. \restoremarks
  5423. %
  5424. % We recover the two marks that the last output routine saved in order
  5425. % to propagate the information in marks added around a chapter heading,
  5426. % which could be otherwise be lost by the time the final page is output.
  5427. %
  5428. %
  5429. % Use the double-column output routine for subsequent pages.
  5430. \output = {\doublecolumnout}%
  5431. %
  5432. % Change the page size parameters. We could do this once outside this
  5433. % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  5434. % format, but then we repeat the same computation. Repeating a couple
  5435. % of assignments once per index is clearly meaningless for the
  5436. % execution time, so we may as well do it in one place.
  5437. %
  5438. % First we halve the line length, less a little for the gutter between
  5439. % the columns. We compute the gutter based on the line length, so it
  5440. % changes automatically with the paper format. The magic constant
  5441. % below is chosen so that the gutter has the same value (well, +-<1pt)
  5442. % as it did when we hard-coded it.
  5443. %
  5444. % We put the result in a separate register, \doublecolumhsize, so we
  5445. % can restore it in \pagesofar, after \hsize itself has (potentially)
  5446. % been clobbered.
  5447. %
  5448. \doublecolumnhsize = \hsize
  5449. \advance\doublecolumnhsize by -.04154\hsize
  5450. \divide\doublecolumnhsize by 2
  5451. \hsize = \doublecolumnhsize
  5452. %
  5453. % Double the \vsize as well.
  5454. \advance\vsize by -\ht\partialpage
  5455. \vsize = 2\vsize
  5456. %
  5457. % For the benefit of balancing columns
  5458. \advance\baselineskip by 0pt plus 0.5pt
  5459. }
  5460. % The double-column output routine for all double-column pages except
  5461. % the last, which is done by \balancecolumns.
  5462. %
  5463. \def\doublecolumnout{%
  5464. %
  5465. \splittopskip=\topskip \splitmaxdepth=\maxdepth
  5466. % Get the available space for the double columns -- the normal
  5467. % (undoubled) page height minus any material left over from the
  5468. % previous page.
  5469. \dimen@ = \vsize
  5470. \divide\dimen@ by 2
  5471. %
  5472. % box0 will be the left-hand column, box2 the right.
  5473. \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
  5474. \global\advance\vsize by 2\ht\partialpage
  5475. \onepageout\pagesofar
  5476. \unvbox\PAGE
  5477. \penalty\outputpenalty
  5478. }
  5479. %
  5480. % Re-output the contents of the output page -- any previous material,
  5481. % followed by the two boxes we just split, in box0 and box2.
  5482. \def\pagesofar{%
  5483. \unvbox\partialpage
  5484. %
  5485. \hsize = \doublecolumnhsize
  5486. \wd0=\hsize \wd2=\hsize
  5487. \hbox to\txipagewidth{\box0\hfil\box2}%
  5488. }
  5489. % Finished with with double columns.
  5490. \def\enddoublecolumns{%
  5491. % The following penalty ensures that the page builder is exercised
  5492. % _before_ we change the output routine. This is necessary in the
  5493. % following situation:
  5494. %
  5495. % The last section of the index consists only of a single entry.
  5496. % Before this section, \pagetotal is less than \pagegoal, so no
  5497. % break occurs before the last section starts. However, the last
  5498. % section, consisting of \initial and the single \entry, does not
  5499. % fit on the page and has to be broken off. Without the following
  5500. % penalty the page builder will not be exercised until \eject
  5501. % below, and by that time we'll already have changed the output
  5502. % routine to the \balancecolumns version, so the next-to-last
  5503. % double-column page will be processed with \balancecolumns, which
  5504. % is wrong: The two columns will go to the main vertical list, with
  5505. % the broken-off section in the recent contributions. As soon as
  5506. % the output routine finishes, TeX starts reconsidering the page
  5507. % break. The two columns and the broken-off section both fit on the
  5508. % page, because the two columns now take up only half of the page
  5509. % goal. When TeX sees \eject from below which follows the final
  5510. % section, it invokes the new output routine that we've set after
  5511. % \balancecolumns below; \onepageout will try to fit the two columns
  5512. % and the final section into the vbox of \txipageheight (see
  5513. % \pagebody), causing an overfull box.
  5514. %
  5515. % Note that glue won't work here, because glue does not exercise the
  5516. % page builder, unlike penalties (see The TeXbook, pp. 280-281).
  5517. \penalty0
  5518. %
  5519. \output = {%
  5520. % Split the last of the double-column material.
  5521. \savemarks
  5522. \balancecolumns
  5523. }%
  5524. \eject % call the \output just set
  5525. \ifdim\pagetotal=0pt
  5526. % Having called \balancecolumns once, we do not
  5527. % want to call it again. Therefore, reset \output to its normal
  5528. % definition right away.
  5529. \global\output = {\onepageout{\pagecontents\PAGE}}%
  5530. %
  5531. \endgroup % started in \begindoublecolumns
  5532. \restoremarks
  5533. % Leave the double-column material on the current page, no automatic
  5534. % page break.
  5535. \box\balancedcolumns
  5536. %
  5537. % \pagegoal was set to the doubled \vsize above, since we restarted
  5538. % the current page. We're now back to normal single-column
  5539. % typesetting, so reset \pagegoal to the normal \vsize.
  5540. \global\vsize = \txipageheight %
  5541. \pagegoal = \txipageheight %
  5542. \else
  5543. % We had some left-over material. This might happen when \doublecolumnout
  5544. % is called in \balancecolumns. Try again.
  5545. \expandafter\enddoublecolumns
  5546. \fi
  5547. }
  5548. \newbox\balancedcolumns
  5549. \setbox\balancedcolumns=\vbox{shouldnt see this}%
  5550. %
  5551. % Only called for the last of the double column material. \doublecolumnout
  5552. % does the others.
  5553. \def\balancecolumns{%
  5554. \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
  5555. \dimen@ = \ht0
  5556. \advance\dimen@ by \topskip
  5557. \advance\dimen@ by-\baselineskip
  5558. \ifdim\dimen@<5\baselineskip
  5559. % Don't split a short final column in two.
  5560. \setbox2=\vbox{}%
  5561. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5562. \else
  5563. \divide\dimen@ by 2 % target to split to
  5564. \dimen@ii = \dimen@
  5565. \splittopskip = \topskip
  5566. % Loop until left column is at least as high as the right column.
  5567. {%
  5568. \vbadness = 10000
  5569. \loop
  5570. \global\setbox3 = \copy0
  5571. \global\setbox1 = \vsplit3 to \dimen@
  5572. \ifdim\ht1<\ht3
  5573. \global\advance\dimen@ by 1pt
  5574. \repeat
  5575. }%
  5576. % Now the left column is in box 1, and the right column in box 3.
  5577. %
  5578. % Check whether the left column has come out higher than the page itself.
  5579. % (Note that we have doubled \vsize for the double columns, so
  5580. % the actual height of the page is 0.5\vsize).
  5581. \ifdim2\ht1>\vsize
  5582. % It appears that we have been called upon to balance too much material.
  5583. % Output some of it with \doublecolumnout, leaving the rest on the page.
  5584. \setbox\PAGE=\box0
  5585. \doublecolumnout
  5586. \else
  5587. % Compare the heights of the two columns.
  5588. \ifdim4\ht1>5\ht3
  5589. % Column heights are too different, so don't make their bottoms
  5590. % flush with each other.
  5591. \setbox2=\vbox to \ht1 {\unvbox3\vfill}%
  5592. \setbox0=\vbox to \ht1 {\unvbox1\vfill}%
  5593. \else
  5594. % Make column bottoms flush with each other.
  5595. \setbox2=\vbox to\ht1{\unvbox3\unskip}%
  5596. \setbox0=\vbox to\ht1{\unvbox1\unskip}%
  5597. \fi
  5598. \global\setbox\balancedcolumns=\vbox{\pagesofar}%
  5599. \fi
  5600. \fi
  5601. %
  5602. }
  5603. \catcode`\@ = \other
  5604. \message{sectioning,}
  5605. % Chapters, sections, etc.
  5606. % Let's start with @part.
  5607. \outer\parseargdef\part{\partzzz{#1}}
  5608. \def\partzzz#1{%
  5609. \chapoddpage
  5610. \null
  5611. \vskip.3\vsize % move it down on the page a bit
  5612. \begingroup
  5613. \noindent \titlefonts\rm #1\par % the text
  5614. \let\lastnode=\empty % no node to associate with
  5615. \writetocentry{part}{#1}{}% but put it in the toc
  5616. \headingsoff % no headline or footline on the part page
  5617. % This outputs a mark at the end of the page that clears \thischapter
  5618. % and \thissection, as is done in \startcontents.
  5619. \let\pchapsepmacro\relax
  5620. \chapmacro{}{Yomitfromtoc}{}%
  5621. \chapoddpage
  5622. \endgroup
  5623. }
  5624. % \unnumberedno is an oxymoron. But we count the unnumbered
  5625. % sections so that we can refer to them unambiguously in the pdf
  5626. % outlines by their "section number". We avoid collisions with chapter
  5627. % numbers by starting them at 10000. (If a document ever has 10000
  5628. % chapters, we're in trouble anyway, I'm sure.)
  5629. \newcount\unnumberedno \unnumberedno = 10000
  5630. \newcount\chapno
  5631. \newcount\secno \secno=0
  5632. \newcount\subsecno \subsecno=0
  5633. \newcount\subsubsecno \subsubsecno=0
  5634. % This counter is funny since it counts through charcodes of letters A, B, ...
  5635. \newcount\appendixno \appendixno = `\@
  5636. %
  5637. % \def\appendixletter{\char\the\appendixno}
  5638. % We do the following ugly conditional instead of the above simple
  5639. % construct for the sake of pdftex, which needs the actual
  5640. % letter in the expansion, not just typeset.
  5641. %
  5642. \def\appendixletter{%
  5643. \ifnum\appendixno=`A A%
  5644. \else\ifnum\appendixno=`B B%
  5645. \else\ifnum\appendixno=`C C%
  5646. \else\ifnum\appendixno=`D D%
  5647. \else\ifnum\appendixno=`E E%
  5648. \else\ifnum\appendixno=`F F%
  5649. \else\ifnum\appendixno=`G G%
  5650. \else\ifnum\appendixno=`H H%
  5651. \else\ifnum\appendixno=`I I%
  5652. \else\ifnum\appendixno=`J J%
  5653. \else\ifnum\appendixno=`K K%
  5654. \else\ifnum\appendixno=`L L%
  5655. \else\ifnum\appendixno=`M M%
  5656. \else\ifnum\appendixno=`N N%
  5657. \else\ifnum\appendixno=`O O%
  5658. \else\ifnum\appendixno=`P P%
  5659. \else\ifnum\appendixno=`Q Q%
  5660. \else\ifnum\appendixno=`R R%
  5661. \else\ifnum\appendixno=`S S%
  5662. \else\ifnum\appendixno=`T T%
  5663. \else\ifnum\appendixno=`U U%
  5664. \else\ifnum\appendixno=`V V%
  5665. \else\ifnum\appendixno=`W W%
  5666. \else\ifnum\appendixno=`X X%
  5667. \else\ifnum\appendixno=`Y Y%
  5668. \else\ifnum\appendixno=`Z Z%
  5669. % The \the is necessary, despite appearances, because \appendixletter is
  5670. % expanded while writing the .toc file. \char\appendixno is not
  5671. % expandable, thus it is written literally, thus all appendixes come out
  5672. % with the same letter (or @) in the toc without it.
  5673. \else\char\the\appendixno
  5674. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
  5675. \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
  5676. % Each @chapter defines these (using marks) as the number+name, number
  5677. % and name of the chapter. Page headings and footings can use
  5678. % these. @section does likewise.
  5679. \def\thischapter{}
  5680. \def\thischapternum{}
  5681. \def\thischaptername{}
  5682. \def\thissection{}
  5683. \def\thissectionnum{}
  5684. \def\thissectionname{}
  5685. \newcount\absseclevel % used to calculate proper heading level
  5686. \newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count
  5687. % @raisesections: treat @section as chapter, @subsection as section, etc.
  5688. \def\raisesections{\global\advance\secbase by -1}
  5689. \let\up=\raisesections % original BFox name
  5690. % @lowersections: treat @chapter as section, @section as subsection, etc.
  5691. \def\lowersections{\global\advance\secbase by 1}
  5692. \let\down=\lowersections % original BFox name
  5693. % we only have subsub.
  5694. \chardef\maxseclevel = 3
  5695. %
  5696. % A numbered section within an unnumbered changes to unnumbered too.
  5697. % To achieve this, remember the "biggest" unnum. sec. we are currently in:
  5698. \chardef\unnlevel = \maxseclevel
  5699. %
  5700. % Trace whether the current chapter is an appendix or not:
  5701. % \chapheadtype is "N" or "A", unnumbered chapters are ignored.
  5702. \def\chapheadtype{N}
  5703. % Choose a heading macro
  5704. % #1 is heading type
  5705. % #2 is heading level
  5706. % #3 is text for heading
  5707. \def\genhead#1#2#3{%
  5708. % Compute the abs. sec. level:
  5709. \absseclevel=#2
  5710. \advance\absseclevel by \secbase
  5711. % Make sure \absseclevel doesn't fall outside the range:
  5712. \ifnum \absseclevel < 0
  5713. \absseclevel = 0
  5714. \else
  5715. \ifnum \absseclevel > 3
  5716. \absseclevel = 3
  5717. \fi
  5718. \fi
  5719. % The heading type:
  5720. \def\headtype{#1}%
  5721. \if \headtype U%
  5722. \ifnum \absseclevel < \unnlevel
  5723. \chardef\unnlevel = \absseclevel
  5724. \fi
  5725. \else
  5726. % Check for appendix sections:
  5727. \ifnum \absseclevel = 0
  5728. \edef\chapheadtype{\headtype}%
  5729. \else
  5730. \if \headtype A\if \chapheadtype N%
  5731. \errmessage{@appendix... within a non-appendix chapter}%
  5732. \fi\fi
  5733. \fi
  5734. % Check for numbered within unnumbered:
  5735. \ifnum \absseclevel > \unnlevel
  5736. \def\headtype{U}%
  5737. \else
  5738. \chardef\unnlevel = 3
  5739. \fi
  5740. \fi
  5741. % Now print the heading:
  5742. \if \headtype U%
  5743. \ifcase\absseclevel
  5744. \unnumberedzzz{#3}%
  5745. \or \unnumberedseczzz{#3}%
  5746. \or \unnumberedsubseczzz{#3}%
  5747. \or \unnumberedsubsubseczzz{#3}%
  5748. \fi
  5749. \else
  5750. \if \headtype A%
  5751. \ifcase\absseclevel
  5752. \appendixzzz{#3}%
  5753. \or \appendixsectionzzz{#3}%
  5754. \or \appendixsubseczzz{#3}%
  5755. \or \appendixsubsubseczzz{#3}%
  5756. \fi
  5757. \else
  5758. \ifcase\absseclevel
  5759. \chapterzzz{#3}%
  5760. \or \seczzz{#3}%
  5761. \or \numberedsubseczzz{#3}%
  5762. \or \numberedsubsubseczzz{#3}%
  5763. \fi
  5764. \fi
  5765. \fi
  5766. \suppressfirstparagraphindent
  5767. }
  5768. % an interface:
  5769. \def\numhead{\genhead N}
  5770. \def\apphead{\genhead A}
  5771. \def\unnmhead{\genhead U}
  5772. % @chapter, @appendix, @unnumbered. Increment top-level counter, reset
  5773. % all lower-level sectioning counters to zero.
  5774. %
  5775. % Also set \chaplevelprefix, which we prepend to @float sequence numbers
  5776. % (e.g., figures), q.v. By default (before any chapter), that is empty.
  5777. \let\chaplevelprefix = \empty
  5778. %
  5779. \outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz
  5780. \def\chapterzzz#1{%
  5781. % section resetting is \global in case the chapter is in a group, such
  5782. % as an @include file.
  5783. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5784. \global\advance\chapno by 1
  5785. %
  5786. % Used for \float.
  5787. \gdef\chaplevelprefix{\the\chapno.}%
  5788. \resetallfloatnos
  5789. %
  5790. % \putwordChapter can contain complex things in translations.
  5791. \toks0=\expandafter{\putwordChapter}%
  5792. \message{\the\toks0 \space \the\chapno}%
  5793. %
  5794. % Write the actual heading.
  5795. \chapmacro{#1}{Ynumbered}{\the\chapno}%
  5796. %
  5797. % So @section and the like are numbered underneath this chapter.
  5798. \global\let\section = \numberedsec
  5799. \global\let\subsection = \numberedsubsec
  5800. \global\let\subsubsection = \numberedsubsubsec
  5801. }
  5802. \outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
  5803. %
  5804. \def\appendixzzz#1{%
  5805. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5806. \global\advance\appendixno by 1
  5807. \gdef\chaplevelprefix{\appendixletter.}%
  5808. \resetallfloatnos
  5809. %
  5810. % \putwordAppendix can contain complex things in translations.
  5811. \toks0=\expandafter{\putwordAppendix}%
  5812. \message{\the\toks0 \space \appendixletter}%
  5813. %
  5814. \chapmacro{#1}{Yappendix}{\appendixletter}%
  5815. %
  5816. \global\let\section = \appendixsec
  5817. \global\let\subsection = \appendixsubsec
  5818. \global\let\subsubsection = \appendixsubsubsec
  5819. }
  5820. % normally unnmhead0 calls unnumberedzzz:
  5821. \outer\parseargdef\unnumbered{\unnmhead0{#1}}
  5822. \def\unnumberedzzz#1{%
  5823. \global\secno=0 \global\subsecno=0 \global\subsubsecno=0
  5824. \global\advance\unnumberedno by 1
  5825. %
  5826. % Since an unnumbered has no number, no prefix for figures.
  5827. \global\let\chaplevelprefix = \empty
  5828. \resetallfloatnos
  5829. %
  5830. % This used to be simply \message{#1}, but TeX fully expands the
  5831. % argument to \message. Therefore, if #1 contained @-commands, TeX
  5832. % expanded them. For example, in `@unnumbered The @cite{Book}', TeX
  5833. % expanded @cite (which turns out to cause errors because \cite is meant
  5834. % to be executed, not expanded).
  5835. %
  5836. % Anyway, we don't want the fully-expanded definition of @cite to appear
  5837. % as a result of the \message, we just want `@cite' itself. We use
  5838. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  5839. % simply yielding the contents of <toks register>. (We also do this for
  5840. % the toc entries.)
  5841. \toks0 = {#1}%
  5842. \message{(\the\toks0)}%
  5843. %
  5844. \chapmacro{#1}{Ynothing}{\the\unnumberedno}%
  5845. %
  5846. \global\let\section = \unnumberedsec
  5847. \global\let\subsection = \unnumberedsubsec
  5848. \global\let\subsubsection = \unnumberedsubsubsec
  5849. }
  5850. % @centerchap is like @unnumbered, but the heading is centered.
  5851. \outer\parseargdef\centerchap{%
  5852. \let\centerparametersmaybe = \centerparameters
  5853. \unnmhead0{#1}%
  5854. \let\centerparametersmaybe = \relax
  5855. }
  5856. % @top is like @unnumbered.
  5857. \let\top\unnumbered
  5858. % Sections.
  5859. %
  5860. \outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz
  5861. \def\seczzz#1{%
  5862. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5863. \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}%
  5864. }
  5865. % normally calls appendixsectionzzz:
  5866. \outer\parseargdef\appendixsection{\apphead1{#1}}
  5867. \def\appendixsectionzzz#1{%
  5868. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5869. \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
  5870. }
  5871. \let\appendixsec\appendixsection
  5872. % normally calls unnumberedseczzz:
  5873. \outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
  5874. \def\unnumberedseczzz#1{%
  5875. \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
  5876. \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
  5877. }
  5878. % Subsections.
  5879. %
  5880. % normally calls numberedsubseczzz:
  5881. \outer\parseargdef\numberedsubsec{\numhead2{#1}}
  5882. \def\numberedsubseczzz#1{%
  5883. \global\subsubsecno=0 \global\advance\subsecno by 1
  5884. \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
  5885. }
  5886. % normally calls appendixsubseczzz:
  5887. \outer\parseargdef\appendixsubsec{\apphead2{#1}}
  5888. \def\appendixsubseczzz#1{%
  5889. \global\subsubsecno=0 \global\advance\subsecno by 1
  5890. \sectionheading{#1}{subsec}{Yappendix}%
  5891. {\appendixletter.\the\secno.\the\subsecno}%
  5892. }
  5893. % normally calls unnumberedsubseczzz:
  5894. \outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
  5895. \def\unnumberedsubseczzz#1{%
  5896. \global\subsubsecno=0 \global\advance\subsecno by 1
  5897. \sectionheading{#1}{subsec}{Ynothing}%
  5898. {\the\unnumberedno.\the\secno.\the\subsecno}%
  5899. }
  5900. % Subsubsections.
  5901. %
  5902. % normally numberedsubsubseczzz:
  5903. \outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
  5904. \def\numberedsubsubseczzz#1{%
  5905. \global\advance\subsubsecno by 1
  5906. \sectionheading{#1}{subsubsec}{Ynumbered}%
  5907. {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5908. }
  5909. % normally appendixsubsubseczzz:
  5910. \outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
  5911. \def\appendixsubsubseczzz#1{%
  5912. \global\advance\subsubsecno by 1
  5913. \sectionheading{#1}{subsubsec}{Yappendix}%
  5914. {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
  5915. }
  5916. % normally unnumberedsubsubseczzz:
  5917. \outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
  5918. \def\unnumberedsubsubseczzz#1{%
  5919. \global\advance\subsubsecno by 1
  5920. \sectionheading{#1}{subsubsec}{Ynothing}%
  5921. {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}%
  5922. }
  5923. % These macros control what the section commands do, according
  5924. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  5925. % Define them by default for a numbered chapter.
  5926. \let\section = \numberedsec
  5927. \let\subsection = \numberedsubsec
  5928. \let\subsubsection = \numberedsubsubsec
  5929. % Define @majorheading, @heading and @subheading
  5930. \def\majorheading{%
  5931. {\advance\chapheadingskip by 10pt \chapbreak }%
  5932. \parsearg\chapheadingzzz
  5933. }
  5934. \def\chapheading{\chapbreak \parsearg\chapheadingzzz}
  5935. \def\chapheadingzzz#1{%
  5936. \vbox{\chapfonts \raggedtitlesettings #1\par}%
  5937. \nobreak\bigskip \nobreak
  5938. \suppressfirstparagraphindent
  5939. }
  5940. % @heading, @subheading, @subsubheading.
  5941. \parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{}
  5942. \suppressfirstparagraphindent}
  5943. \parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{}
  5944. \suppressfirstparagraphindent}
  5945. \parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
  5946. \suppressfirstparagraphindent}
  5947. % These macros generate a chapter, section, etc. heading only
  5948. % (including whitespace, linebreaking, etc. around it),
  5949. % given all the information in convenient, parsed form.
  5950. % Args are the skip and penalty (usually negative)
  5951. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  5952. % Parameter controlling skip before chapter headings (if needed)
  5953. \newskip\chapheadingskip
  5954. % Define plain chapter starts, and page on/off switching for it.
  5955. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  5956. % Start a new page
  5957. \def\chappager{\par\vfill\supereject}
  5958. % \chapoddpage - start on an odd page for a new chapter
  5959. % Because \domark is called before \chapoddpage, the filler page will
  5960. % get the headings for the next chapter, which is wrong. But we don't
  5961. % care -- we just disable all headings on the filler page.
  5962. \def\chapoddpage{%
  5963. \chappager
  5964. \ifodd\pageno \else
  5965. \begingroup
  5966. \headingsoff
  5967. \null
  5968. \chappager
  5969. \endgroup
  5970. \fi
  5971. }
  5972. \parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
  5973. \def\CHAPPAGoff{%
  5974. \global\let\contentsalignmacro = \chappager
  5975. \global\let\pchapsepmacro=\chapbreak
  5976. \global\let\pagealignmacro=\chappager}
  5977. \def\CHAPPAGon{%
  5978. \global\let\contentsalignmacro = \chappager
  5979. \global\let\pchapsepmacro=\chappager
  5980. \global\let\pagealignmacro=\chappager
  5981. \global\def\HEADINGSon{\HEADINGSsingle}}
  5982. \def\CHAPPAGodd{%
  5983. \global\let\contentsalignmacro = \chapoddpage
  5984. \global\let\pchapsepmacro=\chapoddpage
  5985. \global\let\pagealignmacro=\chapoddpage
  5986. \global\def\HEADINGSon{\HEADINGSdouble}}
  5987. \CHAPPAGon
  5988. % \chapmacro - Chapter opening.
  5989. %
  5990. % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
  5991. % Yappendix, Yomitfromtoc), #3 the chapter number.
  5992. % Not used for @heading series.
  5993. %
  5994. % To test against our argument.
  5995. \def\Ynothingkeyword{Ynothing}
  5996. \def\Yappendixkeyword{Yappendix}
  5997. \def\Yomitfromtockeyword{Yomitfromtoc}
  5998. %
  5999. \def\chapmacro#1#2#3{%
  6000. \expandafter\ifx\thisenv\titlepage\else
  6001. \checkenv{}% chapters, etc., should not start inside an environment.
  6002. \fi
  6003. % FIXME: \chapmacro is currently called from inside \titlepage when
  6004. % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
  6005. % this should probably be done by \sectionheading with an option to print
  6006. % in chapter size.
  6007. %
  6008. % Insert the first mark before the heading break (see notes for \domark).
  6009. \let\prevchapterdefs=\lastchapterdefs
  6010. \let\prevsectiondefs=\lastsectiondefs
  6011. \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
  6012. \gdef\thissection{}}%
  6013. %
  6014. \def\temptype{#2}%
  6015. \ifx\temptype\Ynothingkeyword
  6016. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6017. \gdef\thischapter{\thischaptername}}%
  6018. \else\ifx\temptype\Yomitfromtockeyword
  6019. \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
  6020. \gdef\thischapter{}}%
  6021. \else\ifx\temptype\Yappendixkeyword
  6022. \toks0={#1}%
  6023. \xdef\lastchapterdefs{%
  6024. \gdef\noexpand\thischaptername{\the\toks0}%
  6025. \gdef\noexpand\thischapternum{\appendixletter}%
  6026. % \noexpand\putwordAppendix avoids expanding indigestible
  6027. % commands in some of the translations.
  6028. \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
  6029. \noexpand\thischapternum:
  6030. \noexpand\thischaptername}%
  6031. }%
  6032. \else
  6033. \toks0={#1}%
  6034. \xdef\lastchapterdefs{%
  6035. \gdef\noexpand\thischaptername{\the\toks0}%
  6036. \gdef\noexpand\thischapternum{\the\chapno}%
  6037. % \noexpand\putwordChapter avoids expanding indigestible
  6038. % commands in some of the translations.
  6039. \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
  6040. \noexpand\thischapternum:
  6041. \noexpand\thischaptername}%
  6042. }%
  6043. \fi\fi\fi
  6044. %
  6045. % Output the mark. Pass it through \safewhatsit, to take care of
  6046. % the preceding space.
  6047. \safewhatsit\domark
  6048. %
  6049. % Insert the chapter heading break.
  6050. \pchapsepmacro
  6051. %
  6052. % Now the second mark, after the heading break. No break points
  6053. % between here and the heading.
  6054. \let\prevchapterdefs=\lastchapterdefs
  6055. \let\prevsectiondefs=\lastsectiondefs
  6056. \domark
  6057. %
  6058. {%
  6059. \chapfonts \rm
  6060. \let\footnote=\errfootnoteheading % give better error message
  6061. %
  6062. % Have to define \lastsection before calling \donoderef, because the
  6063. % xref code eventually uses it. On the other hand, it has to be called
  6064. % after \pchapsepmacro, or the headline will change too soon.
  6065. \gdef\lastsection{#1}%
  6066. %
  6067. % Only insert the separating space if we have a chapter/appendix
  6068. % number, and don't print the unnumbered ``number''.
  6069. \ifx\temptype\Ynothingkeyword
  6070. \setbox0 = \hbox{}%
  6071. \def\toctype{unnchap}%
  6072. \else\ifx\temptype\Yomitfromtockeyword
  6073. \setbox0 = \hbox{}% contents like unnumbered, but no toc entry
  6074. \def\toctype{omit}%
  6075. \else\ifx\temptype\Yappendixkeyword
  6076. \setbox0 = \hbox{\putwordAppendix{} #3\enspace}%
  6077. \def\toctype{app}%
  6078. \else
  6079. \setbox0 = \hbox{#3\enspace}%
  6080. \def\toctype{numchap}%
  6081. \fi\fi\fi
  6082. %
  6083. % Write the toc entry for this chapter. Must come before the
  6084. % \donoderef, because we include the current node name in the toc
  6085. % entry, and \donoderef resets it to empty.
  6086. \writetocentry{\toctype}{#1}{#3}%
  6087. %
  6088. % For pdftex, we have to write out the node definition (aka, make
  6089. % the pdfdest) after any page break, but before the actual text has
  6090. % been typeset. If the destination for the pdf outline is after the
  6091. % text, then jumping from the outline may wind up with the text not
  6092. % being visible, for instance under high magnification.
  6093. \donoderef{#2}%
  6094. %
  6095. % Typeset the actual heading.
  6096. \nobreak % Avoid page breaks at the interline glue.
  6097. \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
  6098. \unhbox0 #1\par}%
  6099. }%
  6100. \nobreak\bigskip % no page break after a chapter title
  6101. \nobreak
  6102. }
  6103. % @centerchap -- centered and unnumbered.
  6104. \let\centerparametersmaybe = \relax
  6105. \def\centerparameters{%
  6106. \advance\rightskip by 3\rightskip
  6107. \leftskip = \rightskip
  6108. \parfillskip = 0pt
  6109. }
  6110. % Section titles. These macros combine the section number parts and
  6111. % call the generic \sectionheading to do the printing.
  6112. %
  6113. \newskip\secheadingskip
  6114. \def\secheadingbreak{\dobreak \secheadingskip{-1000}}
  6115. % Subsection titles.
  6116. \newskip\subsecheadingskip
  6117. \def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}}
  6118. % Subsubsection titles.
  6119. \def\subsubsecheadingskip{\subsecheadingskip}
  6120. \def\subsubsecheadingbreak{\subsecheadingbreak}
  6121. % Print any size, any type, section title.
  6122. %
  6123. % #1 is the text of the title,
  6124. % #2 is the section level (sec/subsec/subsubsec),
  6125. % #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
  6126. % #4 is the section number.
  6127. %
  6128. \def\seckeyword{sec}
  6129. %
  6130. \def\sectionheading#1#2#3#4{%
  6131. {%
  6132. \def\sectionlevel{#2}%
  6133. \def\temptype{#3}%
  6134. %
  6135. % It is ok for the @heading series commands to appear inside an
  6136. % environment (it's been historically allowed, though the logic is
  6137. % dubious), but not the others.
  6138. \ifx\temptype\Yomitfromtockeyword\else
  6139. \checkenv{}% non-@*heading should not be in an environment.
  6140. \fi
  6141. \let\footnote=\errfootnoteheading
  6142. %
  6143. % Switch to the right set of fonts.
  6144. \csname #2fonts\endcsname \rm
  6145. %
  6146. % Insert first mark before the heading break (see notes for \domark).
  6147. \let\prevsectiondefs=\lastsectiondefs
  6148. \ifx\temptype\Ynothingkeyword
  6149. \ifx\sectionlevel\seckeyword
  6150. \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
  6151. \gdef\thissection{\thissectionname}}%
  6152. \fi
  6153. \else\ifx\temptype\Yomitfromtockeyword
  6154. % Don't redefine \thissection.
  6155. \else\ifx\temptype\Yappendixkeyword
  6156. \ifx\sectionlevel\seckeyword
  6157. \toks0={#1}%
  6158. \xdef\lastsectiondefs{%
  6159. \gdef\noexpand\thissectionname{\the\toks0}%
  6160. \gdef\noexpand\thissectionnum{#4}%
  6161. % \noexpand\putwordSection avoids expanding indigestible
  6162. % commands in some of the translations.
  6163. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6164. \noexpand\thissectionnum:
  6165. \noexpand\thissectionname}%
  6166. }%
  6167. \fi
  6168. \else
  6169. \ifx\sectionlevel\seckeyword
  6170. \toks0={#1}%
  6171. \xdef\lastsectiondefs{%
  6172. \gdef\noexpand\thissectionname{\the\toks0}%
  6173. \gdef\noexpand\thissectionnum{#4}%
  6174. % \noexpand\putwordSection avoids expanding indigestible
  6175. % commands in some of the translations.
  6176. \gdef\noexpand\thissection{\noexpand\putwordSection{}
  6177. \noexpand\thissectionnum:
  6178. \noexpand\thissectionname}%
  6179. }%
  6180. \fi
  6181. \fi\fi\fi
  6182. %
  6183. % Go into vertical mode. Usually we'll already be there, but we
  6184. % don't want the following whatsit to end up in a preceding paragraph
  6185. % if the document didn't happen to have a blank line.
  6186. \par
  6187. %
  6188. % Output the mark. Pass it through \safewhatsit, to take care of
  6189. % the preceding space.
  6190. \safewhatsit\domark
  6191. %
  6192. % Insert space above the heading.
  6193. \csname #2headingbreak\endcsname
  6194. %
  6195. % Now the second mark, after the heading break. No break points
  6196. % between here and the heading.
  6197. \global\let\prevsectiondefs=\lastsectiondefs
  6198. \domark
  6199. %
  6200. % Only insert the space after the number if we have a section number.
  6201. \ifx\temptype\Ynothingkeyword
  6202. \setbox0 = \hbox{}%
  6203. \def\toctype{unn}%
  6204. \gdef\lastsection{#1}%
  6205. \else\ifx\temptype\Yomitfromtockeyword
  6206. % for @headings -- no section number, don't include in toc,
  6207. % and don't redefine \lastsection.
  6208. \setbox0 = \hbox{}%
  6209. \def\toctype{omit}%
  6210. \let\sectionlevel=\empty
  6211. \else\ifx\temptype\Yappendixkeyword
  6212. \setbox0 = \hbox{#4\enspace}%
  6213. \def\toctype{app}%
  6214. \gdef\lastsection{#1}%
  6215. \else
  6216. \setbox0 = \hbox{#4\enspace}%
  6217. \def\toctype{num}%
  6218. \gdef\lastsection{#1}%
  6219. \fi\fi\fi
  6220. %
  6221. % Write the toc entry (before \donoderef). See comments in \chapmacro.
  6222. \writetocentry{\toctype\sectionlevel}{#1}{#4}%
  6223. %
  6224. % Write the node reference (= pdf destination for pdftex).
  6225. % Again, see comments in \chapmacro.
  6226. \donoderef{#3}%
  6227. %
  6228. % Interline glue will be inserted when the vbox is completed.
  6229. % That glue will be a valid breakpoint for the page, since it'll be
  6230. % preceded by a whatsit (usually from the \donoderef, or from the
  6231. % \writetocentry if there was no node). We don't want to allow that
  6232. % break, since then the whatsits could end up on page n while the
  6233. % section is on page n+1, thus toc/etc. are wrong. Debian bug 276000.
  6234. \nobreak
  6235. %
  6236. % Output the actual section heading.
  6237. \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
  6238. \hangindent=\wd0 % zero if no section number
  6239. \unhbox0 #1}%
  6240. }%
  6241. % Add extra space after the heading -- half of whatever came above it.
  6242. % Don't allow stretch, though.
  6243. \kern .5 \csname #2headingskip\endcsname
  6244. %
  6245. % Do not let the kern be a potential breakpoint, as it would be if it
  6246. % was followed by glue.
  6247. \nobreak
  6248. %
  6249. % We'll almost certainly start a paragraph next, so don't let that
  6250. % glue accumulate. (Not a breakpoint because it's preceded by a
  6251. % discardable item.) However, when a paragraph is not started next
  6252. % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
  6253. % or the negative glue will cause weirdly wrong output, typically
  6254. % obscuring the section heading with something else.
  6255. \vskip-\parskip
  6256. %
  6257. % This is so the last item on the main vertical list is a known
  6258. % \penalty > 10000, so \startdefun, etc., can recognize the situation
  6259. % and do the needful.
  6260. \penalty 10001
  6261. }
  6262. \message{toc,}
  6263. % Table of contents.
  6264. \newwrite\tocfile
  6265. % Write an entry to the toc file, opening it if necessary.
  6266. % Called from @chapter, etc.
  6267. %
  6268. % Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno}
  6269. % We append the current node name (if any) and page number as additional
  6270. % arguments for the \{chap,sec,...}entry macros which will eventually
  6271. % read this. The node name is used in the pdf outlines as the
  6272. % destination to jump to.
  6273. %
  6274. % We open the .toc file for writing here instead of at @setfilename (or
  6275. % any other fixed time) so that @contents can be anywhere in the document.
  6276. % But if #1 is `omit', then we don't do anything. This is used for the
  6277. % table of contents chapter openings themselves.
  6278. %
  6279. \newif\iftocfileopened
  6280. \def\omitkeyword{omit}%
  6281. %
  6282. \def\writetocentry#1#2#3{%
  6283. \edef\writetoctype{#1}%
  6284. \ifx\writetoctype\omitkeyword \else
  6285. \iftocfileopened\else
  6286. \immediate\openout\tocfile = \jobname.toc
  6287. \global\tocfileopenedtrue
  6288. \fi
  6289. %
  6290. \iflinks
  6291. {\atdummies
  6292. \edef\temp{%
  6293. \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}%
  6294. \temp
  6295. }%
  6296. \fi
  6297. \fi
  6298. %
  6299. % Tell \shipout to create a pdf destination on each page, if we're
  6300. % writing pdf. These are used in the table of contents. We can't
  6301. % just write one on every page because the title pages are numbered
  6302. % 1 and 2 (the page numbers aren't printed), and so are the first
  6303. % two pages of the document. Thus, we'd have two destinations named
  6304. % `1', and two named `2'.
  6305. \ifpdf
  6306. \global\pdfmakepagedesttrue
  6307. \else
  6308. \ifx\XeTeXrevision\thisisundefined
  6309. \else
  6310. \global\pdfmakepagedesttrue
  6311. \fi
  6312. \fi
  6313. }
  6314. % These characters do not print properly in the Computer Modern roman
  6315. % fonts, so we must take special care. This is more or less redundant
  6316. % with the Texinfo input format setup at the end of this file.
  6317. %
  6318. \def\activecatcodes{%
  6319. \catcode`\"=\active
  6320. \catcode`\$=\active
  6321. \catcode`\<=\active
  6322. \catcode`\>=\active
  6323. \catcode`\\=\active
  6324. \catcode`\^=\active
  6325. \catcode`\_=\active
  6326. \catcode`\|=\active
  6327. \catcode`\~=\active
  6328. }
  6329. % Read the toc file, which is essentially Texinfo input.
  6330. \def\readtocfile{%
  6331. \setupdatafile
  6332. \activecatcodes
  6333. \input \tocreadfilename
  6334. }
  6335. \newskip\contentsrightmargin \contentsrightmargin=1in
  6336. \newcount\savepageno
  6337. \newcount\lastnegativepageno \lastnegativepageno = -1
  6338. % Prepare to read what we've written to \tocfile.
  6339. %
  6340. \def\startcontents#1{%
  6341. % If @setchapternewpage on, and @headings double, the contents should
  6342. % start on an odd page, unlike chapters. Thus, we maintain
  6343. % \contentsalignmacro in parallel with \pagealignmacro.
  6344. % From: Torbjorn Granlund <tege@matematik.su.se>
  6345. \contentsalignmacro
  6346. \immediate\closeout\tocfile
  6347. %
  6348. % Don't need to put `Contents' or `Short Contents' in the headline.
  6349. % It is abundantly clear what they are.
  6350. \chapmacro{#1}{Yomitfromtoc}{}%
  6351. %
  6352. \savepageno = \pageno
  6353. \begingroup % Set up to handle contents files properly.
  6354. \raggedbottom % Worry more about breakpoints than the bottom.
  6355. \entryrightmargin=\contentsrightmargin % Don't use the full line length.
  6356. %
  6357. % Roman numerals for page numbers.
  6358. \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi
  6359. }
  6360. % redefined for the two-volume lispref. We always output on
  6361. % \jobname.toc even if this is redefined.
  6362. %
  6363. \def\tocreadfilename{\jobname.toc}
  6364. % Normal (long) toc.
  6365. %
  6366. \def\contents{%
  6367. \startcontents{\putwordTOC}%
  6368. \openin 1 \tocreadfilename\space
  6369. \ifeof 1 \else
  6370. \readtocfile
  6371. \fi
  6372. \vfill \eject
  6373. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6374. \ifeof 1 \else
  6375. \pdfmakeoutlines
  6376. \fi
  6377. \closein 1
  6378. \endgroup
  6379. \lastnegativepageno = \pageno
  6380. \global\pageno = \savepageno
  6381. }
  6382. % And just the chapters.
  6383. \def\summarycontents{%
  6384. \startcontents{\putwordShortTOC}%
  6385. %
  6386. \let\partentry = \shortpartentry
  6387. \let\numchapentry = \shortchapentry
  6388. \let\appentry = \shortchapentry
  6389. \let\unnchapentry = \shortunnchapentry
  6390. % We want a true roman here for the page numbers.
  6391. \secfonts
  6392. \let\rm=\shortcontrm \let\bf=\shortcontbf
  6393. \let\sl=\shortcontsl \let\tt=\shortconttt
  6394. \rm
  6395. \hyphenpenalty = 10000
  6396. \advance\baselineskip by 1pt % Open it up a little.
  6397. \def\numsecentry##1##2##3##4{}
  6398. \let\appsecentry = \numsecentry
  6399. \let\unnsecentry = \numsecentry
  6400. \let\numsubsecentry = \numsecentry
  6401. \let\appsubsecentry = \numsecentry
  6402. \let\unnsubsecentry = \numsecentry
  6403. \let\numsubsubsecentry = \numsecentry
  6404. \let\appsubsubsecentry = \numsecentry
  6405. \let\unnsubsubsecentry = \numsecentry
  6406. \openin 1 \tocreadfilename\space
  6407. \ifeof 1 \else
  6408. \readtocfile
  6409. \fi
  6410. \closein 1
  6411. \vfill \eject
  6412. \contentsalignmacro % in case @setchapternewpage odd is in effect
  6413. \endgroup
  6414. \lastnegativepageno = \pageno
  6415. \global\pageno = \savepageno
  6416. }
  6417. \let\shortcontents = \summarycontents
  6418. % Typeset the label for a chapter or appendix for the short contents.
  6419. % The arg is, e.g., `A' for an appendix, or `3' for a chapter.
  6420. %
  6421. \def\shortchaplabel#1{%
  6422. % This space should be enough, since a single number is .5em, and the
  6423. % widest letter (M) is 1em, at least in the Computer Modern fonts.
  6424. % But use \hss just in case.
  6425. % (This space doesn't include the extra space that gets added after
  6426. % the label; that gets put in by \shortchapentry above.)
  6427. %
  6428. % We'd like to right-justify chapter numbers, but that looks strange
  6429. % with appendix letters. And right-justifying numbers and
  6430. % left-justifying letters looks strange when there is less than 10
  6431. % chapters. Have to read the whole toc once to know how many chapters
  6432. % there are before deciding ...
  6433. \hbox to 1em{#1\hss}%
  6434. }
  6435. % These macros generate individual entries in the table of contents.
  6436. % The first argument is the chapter or section name.
  6437. % The last argument is the page number.
  6438. % The arguments in between are the chapter number, section number, ...
  6439. % Parts, in the main contents. Replace the part number, which doesn't
  6440. % exist, with an empty box. Let's hope all the numbers have the same width.
  6441. % Also ignore the page number, which is conventionally not printed.
  6442. \def\numeralbox{\setbox0=\hbox{8}\hbox to \wd0{\hfil}}
  6443. \def\partentry#1#2#3#4{%
  6444. % Add stretch and a bonus for breaking the page before the part heading.
  6445. % This reduces the chance of the page being broken immediately after the
  6446. % part heading, before a following chapter heading.
  6447. \vskip 0pt plus 5\baselineskip
  6448. \penalty-300
  6449. \vskip 0pt plus -5\baselineskip
  6450. \dochapentry{\numeralbox\labelspace#1}{}%
  6451. }
  6452. %
  6453. % Parts, in the short toc.
  6454. \def\shortpartentry#1#2#3#4{%
  6455. \penalty-300
  6456. \vskip.5\baselineskip plus.15\baselineskip minus.1\baselineskip
  6457. \shortchapentry{{\bf #1}}{\numeralbox}{}{}%
  6458. }
  6459. % Chapters, in the main contents.
  6460. \def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}}
  6461. % Chapters, in the short toc.
  6462. % See comments in \dochapentry re vbox and related settings.
  6463. \def\shortchapentry#1#2#3#4{%
  6464. \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
  6465. }
  6466. % Appendices, in the main contents.
  6467. % Need the word Appendix, and a fixed-size box.
  6468. %
  6469. \def\appendixbox#1{%
  6470. % We use M since it's probably the widest letter.
  6471. \setbox0 = \hbox{\putwordAppendix{} M}%
  6472. \hbox to \wd0{\putwordAppendix{} #1\hss}}
  6473. %
  6474. \def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\hskip.7em#1}{#4}}
  6475. % Unnumbered chapters.
  6476. \def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
  6477. \def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
  6478. % Sections.
  6479. \def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
  6480. \let\appsecentry=\numsecentry
  6481. \def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}}
  6482. % Subsections.
  6483. \def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}}
  6484. \let\appsubsecentry=\numsubsecentry
  6485. \def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}}
  6486. % And subsubsections.
  6487. \def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}}
  6488. \let\appsubsubsecentry=\numsubsubsecentry
  6489. \def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}}
  6490. % This parameter controls the indentation of the various levels.
  6491. % Same as \defaultparindent.
  6492. \newdimen\tocindent \tocindent = 15pt
  6493. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  6494. % page number.
  6495. %
  6496. % If the toc has to be broken over pages, we want it to be at chapters
  6497. % if at all possible; hence the \penalty.
  6498. \def\dochapentry#1#2{%
  6499. \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip
  6500. \begingroup
  6501. % Move the page numbers slightly to the right
  6502. \advance\entryrightmargin by -0.05em
  6503. \chapentryfonts
  6504. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6505. \endgroup
  6506. \nobreak\vskip .25\baselineskip plus.1\baselineskip
  6507. }
  6508. \def\dosecentry#1#2{\begingroup
  6509. \secentryfonts \leftskip=\tocindent
  6510. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6511. \endgroup}
  6512. \def\dosubsecentry#1#2{\begingroup
  6513. \subsecentryfonts \leftskip=2\tocindent
  6514. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6515. \endgroup}
  6516. \def\dosubsubsecentry#1#2{\begingroup
  6517. \subsubsecentryfonts \leftskip=3\tocindent
  6518. \tocentry{#1}{\dopageno\bgroup#2\egroup}%
  6519. \endgroup}
  6520. % We use the same \entry macro as for the index entries.
  6521. \let\tocentry = \entry
  6522. % Space between chapter (or whatever) number and the title.
  6523. \def\labelspace{\hskip1em \relax}
  6524. \def\dopageno#1{{\rm #1}}
  6525. \def\doshortpageno#1{{\rm #1}}
  6526. \def\chapentryfonts{\secfonts \rm}
  6527. \def\secentryfonts{\textfonts}
  6528. \def\subsecentryfonts{\textfonts}
  6529. \def\subsubsecentryfonts{\textfonts}
  6530. \message{environments,}
  6531. % @foo ... @end foo.
  6532. % @tex ... @end tex escapes into raw TeX temporarily.
  6533. % One exception: @ is still an escape character, so that @end tex works.
  6534. % But \@ or @@ will get a plain @ character.
  6535. \envdef\tex{%
  6536. \setupmarkupstyle{tex}%
  6537. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  6538. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  6539. \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
  6540. \catcode `\%=14
  6541. \catcode `\+=\other
  6542. \catcode `\"=\other
  6543. \catcode `\|=\other
  6544. \catcode `\<=\other
  6545. \catcode `\>=\other
  6546. \catcode `\`=\other
  6547. \catcode `\'=\other
  6548. %
  6549. % ' is active in math mode (mathcode"8000). So reset it, and all our
  6550. % other math active characters (just in case), to plain's definitions.
  6551. \mathactive
  6552. %
  6553. % Inverse of the list at the beginning of the file.
  6554. \let\b=\ptexb
  6555. \let\bullet=\ptexbullet
  6556. \let\c=\ptexc
  6557. \let\,=\ptexcomma
  6558. \let\.=\ptexdot
  6559. \let\dots=\ptexdots
  6560. \let\equiv=\ptexequiv
  6561. \let\!=\ptexexclam
  6562. \let\i=\ptexi
  6563. \let\indent=\ptexindent
  6564. \let\noindent=\ptexnoindent
  6565. \let\{=\ptexlbrace
  6566. \let\+=\tabalign
  6567. \let\}=\ptexrbrace
  6568. \let\/=\ptexslash
  6569. \let\sp=\ptexsp
  6570. \let\*=\ptexstar
  6571. %\let\sup=\ptexsup % do not redefine, we want @sup to work in math mode
  6572. \let\t=\ptext
  6573. \expandafter \let\csname top\endcsname=\ptextop % we've made it outer
  6574. \let\frenchspacing=\plainfrenchspacing
  6575. %
  6576. \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}%
  6577. \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}%
  6578. \def\@{@}%
  6579. }
  6580. % There is no need to define \Etex.
  6581. % Define @lisp ... @end lisp.
  6582. % @lisp environment forms a group so it can rebind things,
  6583. % including the definition of @end lisp (which normally is erroneous).
  6584. % Amount to narrow the margins by for @lisp.
  6585. \newskip\lispnarrowing \lispnarrowing=0.4in
  6586. % This is the definition that ^^M gets inside @lisp, @example, and other
  6587. % such environments. \null is better than a space, since it doesn't
  6588. % have any width.
  6589. \def\lisppar{\null\endgraf}
  6590. % This space is always present above and below environments.
  6591. \newskip\envskipamount \envskipamount = 0pt
  6592. % Make spacing and below environment symmetrical. We use \parskip here
  6593. % to help in doing that, since in @example-like environments \parskip
  6594. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  6595. % start of the next paragraph will insert \parskip.
  6596. %
  6597. \def\aboveenvbreak{{%
  6598. % =10000 instead of <10000 because of a special case in \itemzzz and
  6599. % \sectionheading, q.v.
  6600. \ifnum \lastpenalty=10000 \else
  6601. \advance\envskipamount by \parskip
  6602. \endgraf
  6603. \ifdim\lastskip<\envskipamount
  6604. \removelastskip
  6605. \ifnum\lastpenalty<10000
  6606. % Penalize breaking before the environment, because preceding text
  6607. % often leads into it.
  6608. \penalty100
  6609. \fi
  6610. \vskip\envskipamount
  6611. \fi
  6612. \fi
  6613. }}
  6614. \def\afterenvbreak{{%
  6615. % =10000 instead of <10000 because of a special case in \itemzzz and
  6616. % \sectionheading, q.v.
  6617. \ifnum \lastpenalty=10000 \else
  6618. \advance\envskipamount by \parskip
  6619. \endgraf
  6620. \ifdim\lastskip<\envskipamount
  6621. \removelastskip
  6622. % it's not a good place to break if the last penalty was \nobreak
  6623. % or better ...
  6624. \ifnum\lastpenalty<10000 \penalty-50 \fi
  6625. \vskip\envskipamount
  6626. \fi
  6627. \fi
  6628. }}
  6629. % \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will
  6630. % also clear it, so that its embedded environments do the narrowing again.
  6631. \let\nonarrowing=\relax
  6632. % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
  6633. % environment contents.
  6634. \font\circle=lcircle10
  6635. \newdimen\circthick
  6636. \newdimen\cartouter\newdimen\cartinner
  6637. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  6638. \circthick=\fontdimen8\circle
  6639. %
  6640. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  6641. \def\ctr{{\hskip 6pt\circle\char'010}}
  6642. \def\cbl{{\circle\char'012\hskip -6pt}}
  6643. \def\cbr{{\hskip 6pt\circle\char'011}}
  6644. \def\carttop{\hbox to \cartouter{\hskip\lskip
  6645. \ctl\leaders\hrule height\circthick\hfil\ctr
  6646. \hskip\rskip}}
  6647. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  6648. \cbl\leaders\hrule height\circthick\hfil\cbr
  6649. \hskip\rskip}}
  6650. %
  6651. \newskip\lskip\newskip\rskip
  6652. \envdef\cartouche{%
  6653. \ifhmode\par\fi % can't be in the midst of a paragraph.
  6654. \startsavinginserts
  6655. \lskip=\leftskip \rskip=\rightskip
  6656. \leftskip=0pt\rightskip=0pt % we want these *outside*.
  6657. \cartinner=\hsize \advance\cartinner by-\lskip
  6658. \advance\cartinner by-\rskip
  6659. \cartouter=\hsize
  6660. \advance\cartouter by 18.4pt % allow for 3pt kerns on either
  6661. % side, and for 6pt waste from
  6662. % each corner char, and rule thickness
  6663. \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  6664. %
  6665. % If this cartouche directly follows a sectioning command, we need the
  6666. % \parskip glue (backspaced over by default) or the cartouche can
  6667. % collide with the section heading.
  6668. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
  6669. %
  6670. \setbox\groupbox=\vbox\bgroup
  6671. \baselineskip=0pt\parskip=0pt\lineskip=0pt
  6672. \carttop
  6673. \hbox\bgroup
  6674. \hskip\lskip
  6675. \vrule\kern3pt
  6676. \vbox\bgroup
  6677. \kern3pt
  6678. \hsize=\cartinner
  6679. \baselineskip=\normbskip
  6680. \lineskip=\normlskip
  6681. \parskip=\normpskip
  6682. \vskip -\parskip
  6683. \comment % For explanation, see the end of def\group.
  6684. }
  6685. \def\Ecartouche{%
  6686. \ifhmode\par\fi
  6687. \kern3pt
  6688. \egroup
  6689. \kern3pt\vrule
  6690. \hskip\rskip
  6691. \egroup
  6692. \cartbot
  6693. \egroup
  6694. \addgroupbox
  6695. \checkinserts
  6696. }
  6697. % This macro is called at the beginning of all the @example variants,
  6698. % inside a group.
  6699. \newdimen\nonfillparindent
  6700. \def\nonfillstart{%
  6701. \aboveenvbreak
  6702. \ifdim\hfuzz < 12pt \hfuzz = 12pt \fi % Don't be fussy
  6703. \sepspaces % Make spaces be word-separators rather than space tokens.
  6704. \let\par = \lisppar % don't ignore blank lines
  6705. \obeylines % each line of input is a line of output
  6706. \parskip = 0pt
  6707. % Turn off paragraph indentation but redefine \indent to emulate
  6708. % the normal \indent.
  6709. \nonfillparindent=\parindent
  6710. \parindent = 0pt
  6711. \let\indent\nonfillindent
  6712. %
  6713. \emergencystretch = 0pt % don't try to avoid overfull boxes
  6714. \ifx\nonarrowing\relax
  6715. \advance \leftskip by \lispnarrowing
  6716. \exdentamount=\lispnarrowing
  6717. \else
  6718. \let\nonarrowing = \relax
  6719. \fi
  6720. \let\exdent=\nofillexdent
  6721. }
  6722. \begingroup
  6723. \obeyspaces
  6724. % We want to swallow spaces (but not other tokens) after the fake
  6725. % @indent in our nonfill-environments, where spaces are normally
  6726. % active and set to @tie, resulting in them not being ignored after
  6727. % @indent.
  6728. \gdef\nonfillindent{\futurelet\temp\nonfillindentcheck}%
  6729. \gdef\nonfillindentcheck{%
  6730. \ifx\temp %
  6731. \expandafter\nonfillindentgobble%
  6732. \else%
  6733. \leavevmode\nonfillindentbox%
  6734. \fi%
  6735. }%
  6736. \endgroup
  6737. \def\nonfillindentgobble#1{\nonfillindent}
  6738. \def\nonfillindentbox{\hbox to \nonfillparindent{\hss}}
  6739. % If you want all examples etc. small: @set dispenvsize small.
  6740. % If you want even small examples the full size: @set dispenvsize nosmall.
  6741. % This affects the following displayed environments:
  6742. % @example, @display, @format, @lisp
  6743. %
  6744. \def\smallword{small}
  6745. \def\nosmallword{nosmall}
  6746. \let\SETdispenvsize\relax
  6747. \def\setnormaldispenv{%
  6748. \ifx\SETdispenvsize\smallword
  6749. % end paragraph for sake of leading, in case document has no blank
  6750. % line. This is redundant with what happens in \aboveenvbreak, but
  6751. % we need to do it before changing the fonts, and it's inconvenient
  6752. % to change the fonts afterward.
  6753. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6754. \smallexamplefonts \rm
  6755. \fi
  6756. }
  6757. \def\setsmalldispenv{%
  6758. \ifx\SETdispenvsize\nosmallword
  6759. \else
  6760. \ifnum \lastpenalty=10000 \else \endgraf \fi
  6761. \smallexamplefonts \rm
  6762. \fi
  6763. }
  6764. % We often define two environments, @foo and @smallfoo.
  6765. % Let's do it in one command. #1 is the env name, #2 the definition.
  6766. \def\makedispenvdef#1#2{%
  6767. \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2}%
  6768. \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2}%
  6769. \expandafter\let\csname E#1\endcsname \afterenvbreak
  6770. \expandafter\let\csname Esmall#1\endcsname \afterenvbreak
  6771. }
  6772. % Define two environment synonyms (#1 and #2) for an environment.
  6773. \def\maketwodispenvdef#1#2#3{%
  6774. \makedispenvdef{#1}{#3}%
  6775. \makedispenvdef{#2}{#3}%
  6776. }
  6777. %
  6778. % @lisp: indented, narrowed, typewriter font;
  6779. % @example: same as @lisp.
  6780. %
  6781. % @smallexample and @smalllisp: use smaller fonts.
  6782. % Originally contributed by Pavel@xerox.
  6783. %
  6784. \maketwodispenvdef{lisp}{example}{%
  6785. \nonfillstart
  6786. \tt\setupmarkupstyle{example}%
  6787. \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
  6788. \gobble % eat return
  6789. }
  6790. % @display/@smalldisplay: same as @lisp except keep current font.
  6791. %
  6792. \makedispenvdef{display}{%
  6793. \nonfillstart
  6794. \gobble
  6795. }
  6796. % @format/@smallformat: same as @display except don't narrow margins.
  6797. %
  6798. \makedispenvdef{format}{%
  6799. \let\nonarrowing = t%
  6800. \nonfillstart
  6801. \gobble
  6802. }
  6803. % @flushleft: same as @format, but doesn't obey \SETdispenvsize.
  6804. \envdef\flushleft{%
  6805. \let\nonarrowing = t%
  6806. \nonfillstart
  6807. \gobble
  6808. }
  6809. \let\Eflushleft = \afterenvbreak
  6810. % @flushright.
  6811. %
  6812. \envdef\flushright{%
  6813. \let\nonarrowing = t%
  6814. \nonfillstart
  6815. \advance\leftskip by 0pt plus 1fill\relax
  6816. \gobble
  6817. }
  6818. \let\Eflushright = \afterenvbreak
  6819. % @raggedright does more-or-less normal line breaking but no right
  6820. % justification. From plain.tex. Don't stretch around special
  6821. % characters in urls in this environment, since the stretch at the right
  6822. % should be enough.
  6823. \envdef\raggedright{%
  6824. \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
  6825. \def\urefprestretchamount{0pt}%
  6826. \def\urefpoststretchamount{0pt}%
  6827. }
  6828. \let\Eraggedright\par
  6829. \envdef\raggedleft{%
  6830. \parindent=0pt \leftskip0pt plus2em
  6831. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6832. \hbadness=10000 % Last line will usually be underfull, so turn off
  6833. % badness reporting.
  6834. }
  6835. \let\Eraggedleft\par
  6836. \envdef\raggedcenter{%
  6837. \parindent=0pt \rightskip0pt plus1em \leftskip0pt plus1em
  6838. \spaceskip.3333em \xspaceskip.5em \parfillskip=0pt
  6839. \hbadness=10000 % Last line will usually be underfull, so turn off
  6840. % badness reporting.
  6841. }
  6842. \let\Eraggedcenter\par
  6843. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  6844. % and narrows the margins. We keep \parskip nonzero in general, since
  6845. % we're doing normal filling. So, when using \aboveenvbreak and
  6846. % \afterenvbreak, temporarily make \parskip 0.
  6847. %
  6848. \makedispenvdef{quotation}{\quotationstart}
  6849. %
  6850. \def\quotationstart{%
  6851. \indentedblockstart % same as \indentedblock, but increase right margin too.
  6852. \ifx\nonarrowing\relax
  6853. \advance\rightskip by \lispnarrowing
  6854. \fi
  6855. \parsearg\quotationlabel
  6856. }
  6857. % We have retained a nonzero parskip for the environment, since we're
  6858. % doing normal filling.
  6859. %
  6860. \def\Equotation{%
  6861. \par
  6862. \ifx\quotationauthor\thisisundefined\else
  6863. % indent a bit.
  6864. \leftline{\kern 2\leftskip \sl ---\quotationauthor}%
  6865. \fi
  6866. {\parskip=0pt \afterenvbreak}%
  6867. }
  6868. \def\Esmallquotation{\Equotation}
  6869. % If we're given an argument, typeset it in bold with a colon after.
  6870. \def\quotationlabel#1{%
  6871. \def\temp{#1}%
  6872. \ifx\temp\empty \else
  6873. {\bf #1: }%
  6874. \fi
  6875. }
  6876. % @indentedblock is like @quotation, but indents only on the left and
  6877. % has no optional argument.
  6878. %
  6879. \makedispenvdef{indentedblock}{\indentedblockstart}
  6880. %
  6881. \def\indentedblockstart{%
  6882. {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  6883. \parindent=0pt
  6884. %
  6885. % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  6886. \ifx\nonarrowing\relax
  6887. \advance\leftskip by \lispnarrowing
  6888. \exdentamount = \lispnarrowing
  6889. \else
  6890. \let\nonarrowing = \relax
  6891. \fi
  6892. }
  6893. % Keep a nonzero parskip for the environment, since we're doing normal filling.
  6894. %
  6895. \def\Eindentedblock{%
  6896. \par
  6897. {\parskip=0pt \afterenvbreak}%
  6898. }
  6899. \def\Esmallindentedblock{\Eindentedblock}
  6900. % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>}
  6901. % If we want to allow any <char> as delimiter,
  6902. % we need the curly braces so that makeinfo sees the @verb command, eg:
  6903. % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org
  6904. %
  6905. % [Knuth]: Donald Ervin Knuth, 1996. The TeXbook.
  6906. %
  6907. % [Knuth] p.344; only we need to do the other characters Texinfo sets
  6908. % active too. Otherwise, they get lost as the first character on a
  6909. % verbatim line.
  6910. \def\dospecials{%
  6911. \do\ \do\\\do\{\do\}\do\$\do\&%
  6912. \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~%
  6913. \do\<\do\>\do\|\do\@\do+\do\"%
  6914. % Don't do the quotes -- if we do, @set txicodequoteundirected and
  6915. % @set txicodequotebacktick will not have effect on @verb and
  6916. % @verbatim, and ?` and !` ligatures won't get disabled.
  6917. %\do\`\do\'%
  6918. }
  6919. %
  6920. % [Knuth] p. 380
  6921. \def\uncatcodespecials{%
  6922. \def\do##1{\catcode`##1=\other}\dospecials}
  6923. %
  6924. % Setup for the @verb command.
  6925. %
  6926. % Eight spaces for a tab
  6927. \begingroup
  6928. \catcode`\^^I=\active
  6929. \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }}
  6930. \endgroup
  6931. %
  6932. \def\setupverb{%
  6933. \tt % easiest (and conventionally used) font for verbatim
  6934. \def\par{\leavevmode\endgraf}%
  6935. \setupmarkupstyle{verb}%
  6936. \tabeightspaces
  6937. % Respect line breaks,
  6938. % print special symbols as themselves, and
  6939. % make each space count
  6940. % must do in this order:
  6941. \obeylines \uncatcodespecials \sepspaces
  6942. }
  6943. % Setup for the @verbatim environment
  6944. %
  6945. % Real tab expansion.
  6946. \newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
  6947. %
  6948. % We typeset each line of the verbatim in an \hbox, so we can handle
  6949. % tabs. The \global is in case the verbatim line starts with an accent,
  6950. % or some other command that starts with a begin-group. Otherwise, the
  6951. % entire \verbbox would disappear at the corresponding end-group, before
  6952. % it is typeset. Meanwhile, we can't have nested verbatim commands
  6953. % (can we?), so the \global won't be overwriting itself.
  6954. \newbox\verbbox
  6955. \def\starttabbox{\global\setbox\verbbox=\hbox\bgroup}
  6956. %
  6957. \begingroup
  6958. \catcode`\^^I=\active
  6959. \gdef\tabexpand{%
  6960. \catcode`\^^I=\active
  6961. \def^^I{\leavevmode\egroup
  6962. \dimen\verbbox=\wd\verbbox % the width so far, or since the previous tab
  6963. \divide\dimen\verbbox by\tabw
  6964. \multiply\dimen\verbbox by\tabw % compute previous multiple of \tabw
  6965. \advance\dimen\verbbox by\tabw % advance to next multiple of \tabw
  6966. \wd\verbbox=\dimen\verbbox \box\verbbox \starttabbox
  6967. }%
  6968. }
  6969. \endgroup
  6970. % start the verbatim environment.
  6971. \def\setupverbatim{%
  6972. \let\nonarrowing = t%
  6973. \nonfillstart
  6974. \tt % easiest (and conventionally used) font for verbatim
  6975. % The \leavevmode here is for blank lines. Otherwise, we would
  6976. % never \starttabox and the \egroup would end verbatim mode.
  6977. \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
  6978. \tabexpand
  6979. \setupmarkupstyle{verbatim}%
  6980. % Respect line breaks,
  6981. % print special symbols as themselves, and
  6982. % make each space count.
  6983. % Must do in this order:
  6984. \obeylines \uncatcodespecials \sepspaces
  6985. \everypar{\starttabbox}%
  6986. }
  6987. % Do the @verb magic: verbatim text is quoted by unique
  6988. % delimiter characters. Before first delimiter expect a
  6989. % right brace, after last delimiter expect closing brace:
  6990. %
  6991. % \def\doverb'{'<char>#1<char>'}'{#1}
  6992. %
  6993. % [Knuth] p. 382; only eat outer {}
  6994. \begingroup
  6995. \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other
  6996. \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next]
  6997. \endgroup
  6998. %
  6999. \def\verb{\begingroup\setupverb\doverb}
  7000. %
  7001. %
  7002. % Do the @verbatim magic: define the macro \doverbatim so that
  7003. % the (first) argument ends when '@end verbatim' is reached, ie:
  7004. %
  7005. % \def\doverbatim#1@end verbatim{#1}
  7006. %
  7007. % For Texinfo it's a lot easier than for LaTeX,
  7008. % because texinfo's \verbatim doesn't stop at '\end{verbatim}':
  7009. % we need not redefine '\', '{' and '}'.
  7010. %
  7011. % Inspired by LaTeX's verbatim command set [latex.ltx]
  7012. %
  7013. \begingroup
  7014. \catcode`\ =\active
  7015. \obeylines %
  7016. % ignore everything up to the first ^^M, that's the newline at the end
  7017. % of the @verbatim input line itself. Otherwise we get an extra blank
  7018. % line in the output.
  7019. \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}%
  7020. % We really want {...\end verbatim} in the body of the macro, but
  7021. % without the active space; thus we have to use \xdef and \gobble.
  7022. \endgroup
  7023. %
  7024. \envdef\verbatim{%
  7025. \setupverbatim\doverbatim
  7026. }
  7027. \let\Everbatim = \afterenvbreak
  7028. % @verbatiminclude FILE - insert text of file in verbatim environment.
  7029. %
  7030. \def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude}
  7031. %
  7032. \def\doverbatiminclude#1{%
  7033. {%
  7034. \makevalueexpandable
  7035. \setupverbatim
  7036. \indexnofonts % Allow `@@' and other weird things in file names.
  7037. \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
  7038. \input #1
  7039. \afterenvbreak
  7040. }%
  7041. }
  7042. % @copying ... @end copying.
  7043. % Save the text away for @insertcopying later.
  7044. %
  7045. % We save the uninterpreted tokens, rather than creating a box.
  7046. % Saving the text in a box would be much easier, but then all the
  7047. % typesetting commands (@smallbook, font changes, etc.) have to be done
  7048. % beforehand -- and a) we want @copying to be done first in the source
  7049. % file; b) letting users define the frontmatter in as flexible order as
  7050. % possible is desirable.
  7051. %
  7052. \def\copying{\checkenv{}\begingroup\scanargctxt\docopying}
  7053. \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
  7054. %
  7055. \def\insertcopying{%
  7056. \begingroup
  7057. \parindent = 0pt % paragraph indentation looks wrong on title page
  7058. \scanexp\copyingtext
  7059. \endgroup
  7060. }
  7061. \message{defuns,}
  7062. % @defun etc.
  7063. \newskip\defbodyindent \defbodyindent=.4in
  7064. \newskip\defargsindent \defargsindent=50pt
  7065. \newskip\deflastargmargin \deflastargmargin=18pt
  7066. \newcount\defunpenalty
  7067. % Start the processing of @deffn:
  7068. \def\startdefun{%
  7069. \ifnum\lastpenalty<10000
  7070. \medbreak
  7071. \defunpenalty=10003 % Will keep this @deffn together with the
  7072. % following @def command, see below.
  7073. \else
  7074. % If there are two @def commands in a row, we'll have a \nobreak,
  7075. % which is there to keep the function description together with its
  7076. % header. But if there's nothing but headers, we need to allow a
  7077. % break somewhere. Check specifically for penalty 10002, inserted
  7078. % by \printdefunline, instead of 10000, since the sectioning
  7079. % commands also insert a nobreak penalty, and we don't want to allow
  7080. % a break between a section heading and a defun.
  7081. %
  7082. % As a further refinement, we avoid "club" headers by signalling
  7083. % with penalty of 10003 after the very first @deffn in the
  7084. % sequence (see above), and penalty of 10002 after any following
  7085. % @def command.
  7086. \ifnum\lastpenalty=10002 \penalty2000 \else \defunpenalty=10002 \fi
  7087. %
  7088. % Similarly, after a section heading, do not allow a break.
  7089. % But do insert the glue.
  7090. \medskip % preceded by discardable penalty, so not a breakpoint
  7091. \fi
  7092. %
  7093. \parindent=0in
  7094. \advance\leftskip by \defbodyindent
  7095. \exdentamount=\defbodyindent
  7096. }
  7097. \def\dodefunx#1{%
  7098. % First, check whether we are in the right environment:
  7099. \checkenv#1%
  7100. %
  7101. % As above, allow line break if we have multiple x headers in a row.
  7102. % It's not a great place, though.
  7103. \ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
  7104. %
  7105. % And now, it's time to reuse the body of the original defun:
  7106. \expandafter\gobbledefun#1%
  7107. }
  7108. \def\gobbledefun#1\startdefun{}
  7109. % \printdefunline \deffnheader{text}
  7110. %
  7111. \def\printdefunline#1#2{%
  7112. \begingroup
  7113. % call \deffnheader:
  7114. #1#2 \endheader
  7115. % common ending:
  7116. \interlinepenalty = 10000
  7117. \advance\rightskip by 0pt plus 1fil\relax
  7118. \endgraf
  7119. \nobreak\vskip -\parskip
  7120. \penalty\defunpenalty % signal to \startdefun and \dodefunx
  7121. % Some of the @defun-type tags do not enable magic parentheses,
  7122. % rendering the following check redundant. But we don't optimize.
  7123. \checkparencounts
  7124. \endgroup
  7125. }
  7126. \def\Edefun{\endgraf\medbreak}
  7127. % \makedefun{deffn} creates \deffn, \deffnx and \Edeffn;
  7128. % the only thing remaining is to define \deffnheader.
  7129. %
  7130. \def\makedefun#1{%
  7131. \expandafter\let\csname E#1\endcsname = \Edefun
  7132. \edef\temp{\noexpand\domakedefun
  7133. \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}%
  7134. \temp
  7135. }
  7136. % \domakedefun \deffn \deffnx \deffnheader { (defn. of \deffnheader) }
  7137. %
  7138. % Define \deffn and \deffnx, without parameters.
  7139. % \deffnheader has to be defined explicitly.
  7140. %
  7141. \def\domakedefun#1#2#3{%
  7142. \envdef#1{%
  7143. \startdefun
  7144. \doingtypefnfalse % distinguish typed functions from all else
  7145. \parseargusing\activeparens{\printdefunline#3}%
  7146. }%
  7147. \def#2{\dodefunx#1}%
  7148. \def#3%
  7149. }
  7150. \newif\ifdoingtypefn % doing typed function?
  7151. \newif\ifrettypeownline % typeset return type on its own line?
  7152. % @deftypefnnewline on|off says whether the return type of typed functions
  7153. % are printed on their own line. This affects @deftypefn, @deftypefun,
  7154. % @deftypeop, and @deftypemethod.
  7155. %
  7156. \parseargdef\deftypefnnewline{%
  7157. \def\temp{#1}%
  7158. \ifx\temp\onword
  7159. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7160. = \empty
  7161. \else\ifx\temp\offword
  7162. \expandafter\let\csname SETtxideftypefnnl\endcsname
  7163. = \relax
  7164. \else
  7165. \errhelp = \EMsimple
  7166. \errmessage{Unknown @txideftypefnnl value `\temp',
  7167. must be on|off}%
  7168. \fi\fi
  7169. }
  7170. % Untyped functions:
  7171. % @deffn category name args
  7172. \makedefun{deffn}{\deffngeneral{}}
  7173. % @deffn category class name args
  7174. \makedefun{defop}#1 {\defopon{#1\ \putwordon}}
  7175. % \defopon {category on}class name args
  7176. \def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7177. % \deffngeneral {subind}category name args
  7178. %
  7179. \def\deffngeneral#1#2 #3 #4\endheader{%
  7180. % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
  7181. \dosubind{fn}{\code{#3}}{#1}%
  7182. \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
  7183. }
  7184. % Typed functions:
  7185. % @deftypefn category type name args
  7186. \makedefun{deftypefn}{\deftypefngeneral{}}
  7187. % @deftypeop category class type name args
  7188. \makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}}
  7189. % \deftypeopon {category on}class type name args
  7190. \def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} }
  7191. % \deftypefngeneral {subind}category type name args
  7192. %
  7193. \def\deftypefngeneral#1#2 #3 #4 #5\endheader{%
  7194. \dosubind{fn}{\code{#4}}{#1}%
  7195. \doingtypefntrue
  7196. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7197. }
  7198. % Typed variables:
  7199. % @deftypevr category type var args
  7200. \makedefun{deftypevr}{\deftypecvgeneral{}}
  7201. % @deftypecv category class type var args
  7202. \makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}}
  7203. % \deftypecvof {category of}class type var args
  7204. \def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} }
  7205. % \deftypecvgeneral {subind}category type var args
  7206. %
  7207. \def\deftypecvgeneral#1#2 #3 #4 #5\endheader{%
  7208. \dosubind{vr}{\code{#4}}{#1}%
  7209. \defname{#2}{#3}{#4}\defunargs{#5\unskip}%
  7210. }
  7211. % Untyped variables:
  7212. % @defvr category var args
  7213. \makedefun{defvr}#1 {\deftypevrheader{#1} {} }
  7214. % @defcv category class var args
  7215. \makedefun{defcv}#1 {\defcvof{#1\ \putwordof}}
  7216. % \defcvof {category of}class var args
  7217. \def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
  7218. % Types:
  7219. % @deftp category name args
  7220. \makedefun{deftp}#1 #2 #3\endheader{%
  7221. \doind{tp}{\code{#2}}%
  7222. \defname{#1}{}{#2}\defunargs{#3\unskip}%
  7223. }
  7224. % Remaining @defun-like shortcuts:
  7225. \makedefun{defun}{\deffnheader{\putwordDeffunc} }
  7226. \makedefun{defmac}{\deffnheader{\putwordDefmac} }
  7227. \makedefun{defspec}{\deffnheader{\putwordDefspec} }
  7228. \makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} }
  7229. \makedefun{defvar}{\defvrheader{\putwordDefvar} }
  7230. \makedefun{defopt}{\defvrheader{\putwordDefopt} }
  7231. \makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} }
  7232. \makedefun{defmethod}{\defopon\putwordMethodon}
  7233. \makedefun{deftypemethod}{\deftypeopon\putwordMethodon}
  7234. \makedefun{defivar}{\defcvof\putwordInstanceVariableof}
  7235. \makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof}
  7236. % \defname, which formats the name of the @def (not the args).
  7237. % #1 is the category, such as "Function".
  7238. % #2 is the return type, if any.
  7239. % #3 is the function name.
  7240. %
  7241. % We are followed by (but not passed) the arguments, if any.
  7242. %
  7243. \def\defname#1#2#3{%
  7244. \par
  7245. % Get the values of \leftskip and \rightskip as they were outside the @def...
  7246. \advance\leftskip by -\defbodyindent
  7247. %
  7248. % Determine if we are typesetting the return type of a typed function
  7249. % on a line by itself.
  7250. \rettypeownlinefalse
  7251. \ifdoingtypefn % doing a typed function specifically?
  7252. % then check user option for putting return type on its own line:
  7253. \expandafter\ifx\csname SETtxideftypefnnl\endcsname\relax \else
  7254. \rettypeownlinetrue
  7255. \fi
  7256. \fi
  7257. %
  7258. % How we'll format the category name. Putting it in brackets helps
  7259. % distinguish it from the body text that may end up on the next line
  7260. % just below it.
  7261. \def\temp{#1}%
  7262. \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi}
  7263. %
  7264. % Figure out line sizes for the paragraph shape. We'll always have at
  7265. % least two.
  7266. \tempnum = 2
  7267. %
  7268. % The first line needs space for \box0; but if \rightskip is nonzero,
  7269. % we need only space for the part of \box0 which exceeds it:
  7270. \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip
  7271. %
  7272. % If doing a return type on its own line, we'll have another line.
  7273. \ifrettypeownline
  7274. \advance\tempnum by 1
  7275. \def\maybeshapeline{0in \hsize}%
  7276. \else
  7277. \def\maybeshapeline{}%
  7278. \fi
  7279. %
  7280. % The continuations:
  7281. \dimen2=\hsize \advance\dimen2 by -\defargsindent
  7282. %
  7283. % The final paragraph shape:
  7284. \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
  7285. %
  7286. % Put the category name at the right margin.
  7287. \noindent
  7288. \hbox to 0pt{%
  7289. \hfil\box0 \kern-\hsize
  7290. % \hsize has to be shortened this way:
  7291. \kern\leftskip
  7292. % Intentionally do not respect \rightskip, since we need the space.
  7293. }%
  7294. %
  7295. % Allow all lines to be underfull without complaint:
  7296. \tolerance=10000 \hbadness=10000
  7297. \exdentamount=\defbodyindent
  7298. {%
  7299. % defun fonts. We use typewriter by default (used to be bold) because:
  7300. % . we're printing identifiers, they should be in tt in principle.
  7301. % . in languages with many accents, such as Czech or French, it's
  7302. % common to leave accents off identifiers. The result looks ok in
  7303. % tt, but exceedingly strange in rm.
  7304. % . we don't want -- and --- to be treated as ligatures.
  7305. % . this still does not fix the ?` and !` ligatures, but so far no
  7306. % one has made identifiers using them :).
  7307. \df \tt
  7308. \def\temp{#2}% text of the return type
  7309. \ifx\temp\empty\else
  7310. \tclose{\temp}% typeset the return type
  7311. \ifrettypeownline
  7312. % put return type on its own line; prohibit line break following:
  7313. \hfil\vadjust{\nobreak}\break
  7314. \else
  7315. \space % type on same line, so just followed by a space
  7316. \fi
  7317. \fi % no return type
  7318. #3% output function name
  7319. }%
  7320. {\rm\enskip}% hskip 0.5 em of \rmfont
  7321. %
  7322. \boldbrax
  7323. % arguments will be output next, if any.
  7324. }
  7325. % Print arguments in slanted roman (not ttsl), inconsistently with using
  7326. % tt for the name. This is because literal text is sometimes needed in
  7327. % the argument list (groff manual), and ttsl and tt are not very
  7328. % distinguishable. Prevent hyphenation at `-' chars.
  7329. %
  7330. \def\defunargs#1{%
  7331. % use sl by default (not ttsl),
  7332. % tt for the names.
  7333. \df \sl \hyphenchar\font=0
  7334. %
  7335. % On the other hand, if an argument has two dashes (for instance), we
  7336. % want a way to get ttsl. We used to recommend @var for that, so
  7337. % leave the code in, but it's strange for @var to lead to typewriter.
  7338. % Nowadays we recommend @code, since the difference between a ttsl hyphen
  7339. % and a tt hyphen is pretty tiny. @code also disables ?` !`.
  7340. \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
  7341. #1%
  7342. \sl\hyphenchar\font=45
  7343. }
  7344. % We want ()&[] to print specially on the defun line.
  7345. %
  7346. \def\activeparens{%
  7347. \catcode`\(=\active \catcode`\)=\active
  7348. \catcode`\[=\active \catcode`\]=\active
  7349. \catcode`\&=\active
  7350. }
  7351. % Make control sequences which act like normal parenthesis chars.
  7352. \let\lparen = ( \let\rparen = )
  7353. % Be sure that we always have a definition for `(', etc. For example,
  7354. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  7355. % so TeX would otherwise complain about undefined control sequence.
  7356. {
  7357. \activeparens
  7358. \global\let(=\lparen \global\let)=\rparen
  7359. \global\let[=\lbrack \global\let]=\rbrack
  7360. \global\let& = \&
  7361. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  7362. \gdef\magicamp{\let&=\amprm}
  7363. }
  7364. \let\ampchar\&
  7365. \newcount\parencount
  7366. % If we encounter &foo, then turn on ()-hacking afterwards
  7367. \newif\ifampseen
  7368. \def\amprm#1 {\ampseentrue{\bf\&#1 }}
  7369. \def\parenfont{%
  7370. \ifampseen
  7371. % At the first level, print parens in roman,
  7372. % otherwise use the default font.
  7373. \ifnum \parencount=1 \rm \fi
  7374. \else
  7375. % The \sf parens (in \boldbrax) actually are a little bolder than
  7376. % the contained text. This is especially needed for [ and ] .
  7377. \sf
  7378. \fi
  7379. }
  7380. \def\infirstlevel#1{%
  7381. \ifampseen
  7382. \ifnum\parencount=1
  7383. #1%
  7384. \fi
  7385. \fi
  7386. }
  7387. \def\bfafterword#1 {#1 \bf}
  7388. \def\opnr{%
  7389. \global\advance\parencount by 1
  7390. {\parenfont(}%
  7391. \infirstlevel \bfafterword
  7392. }
  7393. \def\clnr{%
  7394. {\parenfont)}%
  7395. \infirstlevel \sl
  7396. \global\advance\parencount by -1
  7397. }
  7398. \newcount\brackcount
  7399. \def\lbrb{%
  7400. \global\advance\brackcount by 1
  7401. {\bf[}%
  7402. }
  7403. \def\rbrb{%
  7404. {\bf]}%
  7405. \global\advance\brackcount by -1
  7406. }
  7407. \def\checkparencounts{%
  7408. \ifnum\parencount=0 \else \badparencount \fi
  7409. \ifnum\brackcount=0 \else \badbrackcount \fi
  7410. }
  7411. % these should not use \errmessage; the glibc manual, at least, actually
  7412. % has such constructs (when documenting function pointers).
  7413. \def\badparencount{%
  7414. \message{Warning: unbalanced parentheses in @def...}%
  7415. \global\parencount=0
  7416. }
  7417. \def\badbrackcount{%
  7418. \message{Warning: unbalanced square brackets in @def...}%
  7419. \global\brackcount=0
  7420. }
  7421. \message{macros,}
  7422. % @macro.
  7423. % To do this right we need a feature of e-TeX, \scantokens,
  7424. % which we arrange to emulate with a temporary file in ordinary TeX.
  7425. \ifx\eTeXversion\thisisundefined
  7426. \newwrite\macscribble
  7427. \def\scantokens#1{%
  7428. \toks0={#1}%
  7429. \immediate\openout\macscribble=\jobname.tmp
  7430. \immediate\write\macscribble{\the\toks0}%
  7431. \immediate\closeout\macscribble
  7432. \input \jobname.tmp
  7433. }
  7434. \fi
  7435. % alias because \c means cedilla in @tex or @math
  7436. \let\texinfoc=\c
  7437. \newcount\savedcatcodeone
  7438. \newcount\savedcatcodetwo
  7439. % Used at the time of macro expansion.
  7440. % Argument is macro body with arguments substituted
  7441. \def\scanmacro#1{%
  7442. \newlinechar`\^^M
  7443. \def\xeatspaces{\eatspaces}%
  7444. %
  7445. % Temporarily undo catcode changes of \printindex. Set catcode of @ to
  7446. % 0 so that @-commands in macro expansions aren't printed literally when
  7447. % formatting an index file, where \ is used as the escape character.
  7448. \savedcatcodeone=\catcode`\@
  7449. \savedcatcodetwo=\catcode`\\
  7450. \catcode`\@=0
  7451. \catcode`\\=\active
  7452. %
  7453. % Process the macro body under the current catcode regime.
  7454. \scantokens{#1@texinfoc}%
  7455. %
  7456. \catcode`\@=\savedcatcodeone
  7457. \catcode`\\=\savedcatcodetwo
  7458. %
  7459. % The \texinfoc is to remove the \newlinechar added by \scantokens, and
  7460. % can be noticed by \parsearg.
  7461. % We avoid surrounding the call to \scantokens with \bgroup and \egroup
  7462. % to allow macros to open or close groups themselves.
  7463. }
  7464. % Used for copying and captions
  7465. \def\scanexp#1{%
  7466. \expandafter\scanmacro\expandafter{#1}%
  7467. }
  7468. \newcount\paramno % Count of parameters
  7469. \newtoks\macname % Macro name
  7470. \newif\ifrecursive % Is it recursive?
  7471. % List of all defined macros in the form
  7472. % \commondummyword\macro1\commondummyword\macro2...
  7473. % Currently is also contains all @aliases; the list can be split
  7474. % if there is a need.
  7475. \def\macrolist{}
  7476. % Add the macro to \macrolist
  7477. \def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname}
  7478. \def\addtomacrolistxxx#1{%
  7479. \toks0 = \expandafter{\macrolist\commondummyword#1}%
  7480. \xdef\macrolist{\the\toks0}%
  7481. }
  7482. % Utility routines.
  7483. % This does \let #1 = #2, with \csnames; that is,
  7484. % \let \csname#1\endcsname = \csname#2\endcsname
  7485. % (except of course we have to play expansion games).
  7486. %
  7487. \def\cslet#1#2{%
  7488. \expandafter\let
  7489. \csname#1\expandafter\endcsname
  7490. \csname#2\endcsname
  7491. }
  7492. % Trim leading and trailing spaces off a string.
  7493. % Concepts from aro-bend problem 15 (see CTAN).
  7494. {\catcode`\@=11
  7495. \gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }}
  7496. \gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@}
  7497. \gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @}
  7498. \def\unbrace#1{#1}
  7499. \unbrace{\gdef\trim@@@ #1 } #2@{#1}
  7500. }
  7501. % Trim a single trailing ^^M off a string.
  7502. {\catcode`\^^M=\other \catcode`\Q=3%
  7503. \gdef\eatcr #1{\eatcra #1Q^^MQ}%
  7504. \gdef\eatcra#1^^MQ{\eatcrb#1Q}%
  7505. \gdef\eatcrb#1Q#2Q{#1}%
  7506. }
  7507. % Macro bodies are absorbed as an argument in a context where
  7508. % all characters are catcode 10, 11 or 12, except \ which is active
  7509. % (as in normal texinfo). It is necessary to change the definition of \
  7510. % to recognize macro arguments; this is the job of \mbodybackslash.
  7511. %
  7512. % Non-ASCII encodings make 8-bit characters active, so un-activate
  7513. % them to avoid their expansion. Must do this non-globally, to
  7514. % confine the change to the current group.
  7515. %
  7516. % It's necessary to have hard CRs when the macro is executed. This is
  7517. % done by making ^^M (\endlinechar) catcode 12 when reading the macro
  7518. % body, and then making it the \newlinechar in \scanmacro.
  7519. %
  7520. \def\scanctxt{% used as subroutine
  7521. \catcode`\"=\other
  7522. \catcode`\+=\other
  7523. \catcode`\<=\other
  7524. \catcode`\>=\other
  7525. \catcode`\^=\other
  7526. \catcode`\_=\other
  7527. \catcode`\|=\other
  7528. \catcode`\~=\other
  7529. \passthroughcharstrue
  7530. }
  7531. \def\scanargctxt{% used for copying and captions, not macros.
  7532. \scanctxt
  7533. \catcode`\@=\other
  7534. \catcode`\\=\other
  7535. \catcode`\^^M=\other
  7536. }
  7537. \def\macrobodyctxt{% used for @macro definitions
  7538. \scanctxt
  7539. \catcode`\ =\other
  7540. \catcode`\@=\other
  7541. \catcode`\{=\other
  7542. \catcode`\}=\other
  7543. \catcode`\^^M=\other
  7544. \usembodybackslash
  7545. }
  7546. % Used when scanning braced macro arguments. Note, however, that catcode
  7547. % changes here are ineffectual if the macro invocation was nested inside
  7548. % an argument to another Texinfo command.
  7549. \def\macroargctxt{%
  7550. \scanctxt
  7551. \catcode`\ =\active
  7552. \catcode`\^^M=\other
  7553. \catcode`\\=\active
  7554. }
  7555. \def\macrolineargctxt{% used for whole-line arguments without braces
  7556. \scanctxt
  7557. \catcode`\{=\other
  7558. \catcode`\}=\other
  7559. }
  7560. % \mbodybackslash is the definition of \ in @macro bodies.
  7561. % It maps \foo\ => \csname macarg.foo\endcsname => #N
  7562. % where N is the macro parameter number.
  7563. % We define \csname macarg.\endcsname to be \realbackslash, so
  7564. % \\ in macro replacement text gets you a backslash.
  7565. %
  7566. {\catcode`@=0 @catcode`@\=@active
  7567. @gdef@usembodybackslash{@let\=@mbodybackslash}
  7568. @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname}
  7569. }
  7570. \expandafter\def\csname macarg.\endcsname{\realbackslash}
  7571. \def\margbackslash#1{\char`\#1 }
  7572. \def\macro{\recursivefalse\parsearg\macroxxx}
  7573. \def\rmacro{\recursivetrue\parsearg\macroxxx}
  7574. \def\macroxxx#1{%
  7575. \getargs{#1}% now \macname is the macname and \argl the arglist
  7576. \ifx\argl\empty % no arguments
  7577. \paramno=0\relax
  7578. \else
  7579. \expandafter\parsemargdef \argl;%
  7580. \if\paramno>256\relax
  7581. \ifx\eTeXversion\thisisundefined
  7582. \errhelp = \EMsimple
  7583. \errmessage{You need eTeX to compile a file with macros with more than 256 arguments}
  7584. \fi
  7585. \fi
  7586. \fi
  7587. \if1\csname ismacro.\the\macname\endcsname
  7588. \message{Warning: redefining \the\macname}%
  7589. \else
  7590. \expandafter\ifx\csname \the\macname\endcsname \relax
  7591. \else \errmessage{Macro name \the\macname\space already defined}\fi
  7592. \global\cslet{macsave.\the\macname}{\the\macname}%
  7593. \global\expandafter\let\csname ismacro.\the\macname\endcsname=1%
  7594. \addtomacrolist{\the\macname}%
  7595. \fi
  7596. \begingroup \macrobodyctxt
  7597. \ifrecursive \expandafter\parsermacbody
  7598. \else \expandafter\parsemacbody
  7599. \fi}
  7600. \parseargdef\unmacro{%
  7601. \if1\csname ismacro.#1\endcsname
  7602. \global\cslet{#1}{macsave.#1}%
  7603. \global\expandafter\let \csname ismacro.#1\endcsname=0%
  7604. % Remove the macro name from \macrolist:
  7605. \begingroup
  7606. \expandafter\let\csname#1\endcsname \relax
  7607. \let\commondummyword\unmacrodo
  7608. \xdef\macrolist{\macrolist}%
  7609. \endgroup
  7610. \else
  7611. \errmessage{Macro #1 not defined}%
  7612. \fi
  7613. }
  7614. % Called by \do from \dounmacro on each macro. The idea is to omit any
  7615. % macro definitions that have been changed to \relax.
  7616. %
  7617. \def\unmacrodo#1{%
  7618. \ifx #1\relax
  7619. % remove this
  7620. \else
  7621. \noexpand\commondummyword \noexpand#1%
  7622. \fi
  7623. }
  7624. % \getargs -- Parse the arguments to a @macro line. Set \macname to
  7625. % the name of the macro, and \argl to the braced argument list.
  7626. \def\getargs#1{\getargsxxx#1{}}
  7627. \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs}
  7628. \def\getmacname#1 #2\relax{\macname={#1}}
  7629. \def\getmacargs#1{\def\argl{#1}}
  7630. % This made use of the feature that if the last token of a
  7631. % <parameter list> is #, then the preceding argument is delimited by
  7632. % an opening brace, and that opening brace is not consumed.
  7633. % Parse the optional {params} list to @macro or @rmacro.
  7634. % Set \paramno to the number of arguments,
  7635. % and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
  7636. % three-param macro.) Define \macarg.BLAH for each BLAH in the params
  7637. % list to some hook where the argument is to be expanded. If there are
  7638. % less than 10 arguments that hook is to be replaced by ##N where N
  7639. % is the position in that list, that is to say the macro arguments are to be
  7640. % defined `a la TeX in the macro body.
  7641. %
  7642. % That gets used by \mbodybackslash (above).
  7643. %
  7644. % If there are 10 or more arguments, a different technique is used: see
  7645. % \parsemmanyargdef.
  7646. %
  7647. \def\parsemargdef#1;{%
  7648. \paramno=0\def\paramlist{}%
  7649. \let\hash\relax
  7650. % \hash is redefined to `#' later to get it into definitions
  7651. \let\xeatspaces\relax
  7652. \parsemargdefxxx#1,;,%
  7653. \ifnum\paramno<10\relax\else
  7654. \paramno0\relax
  7655. \parsemmanyargdef@@#1,;,% 10 or more arguments
  7656. \fi
  7657. }
  7658. \def\parsemargdefxxx#1,{%
  7659. \if#1;\let\next=\relax
  7660. \else \let\next=\parsemargdefxxx
  7661. \advance\paramno by 1
  7662. \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
  7663. {\xeatspaces{\hash\the\paramno}}%
  7664. \edef\paramlist{\paramlist\hash\the\paramno,}%
  7665. \fi\next}
  7666. % \parsemacbody, \parsermacbody
  7667. %
  7668. % Read recursive and nonrecursive macro bodies. (They're different since
  7669. % rec and nonrec macros end differently.)
  7670. %
  7671. % We are in \macrobodyctxt, and the \xdef causes backslashshes in the macro
  7672. % body to be transformed.
  7673. % Set \macrobody to the body of the macro, and call \defmacro.
  7674. %
  7675. {\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
  7676. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7677. {\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
  7678. \xdef\macrobody{\eatcr{#1}}\endgroup\defmacro}}%
  7679. % Make @ a letter, so that we can make private-to-Texinfo macro names.
  7680. \edef\texiatcatcode{\the\catcode`\@}
  7681. \catcode `@=11\relax
  7682. %%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
  7683. % If there are 10 or more arguments, a different technique is used, where the
  7684. % hook remains in the body, and when macro is to be expanded the body is
  7685. % processed again to replace the arguments.
  7686. %
  7687. % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the
  7688. % argument N value and then \edef the body (nothing else will expand because of
  7689. % the catcode regime under which the body was input).
  7690. %
  7691. % If you compile with TeX (not eTeX), and you have macros with 10 or more
  7692. % arguments, no macro can have more than 256 arguments (else error).
  7693. %
  7694. % In case that there are 10 or more arguments we parse again the arguments
  7695. % list to set new definitions for the \macarg.BLAH macros corresponding to
  7696. % each BLAH argument. It was anyhow needed to parse already once this list
  7697. % in order to count the arguments, and as macros with at most 9 arguments
  7698. % are by far more frequent than macro with 10 or more arguments, defining
  7699. % twice the \macarg.BLAH macros does not cost too much processing power.
  7700. \def\parsemmanyargdef@@#1,{%
  7701. \if#1;\let\next=\relax
  7702. \else
  7703. \let\next=\parsemmanyargdef@@
  7704. \edef\tempb{\eatspaces{#1}}%
  7705. \expandafter\def\expandafter\tempa
  7706. \expandafter{\csname macarg.\tempb\endcsname}%
  7707. % Note that we need some extra \noexpand\noexpand, this is because we
  7708. % don't want \the to be expanded in the \parsermacbody as it uses an
  7709. % \xdef .
  7710. \expandafter\edef\tempa
  7711. {\noexpand\noexpand\noexpand\the\toks\the\paramno}%
  7712. \advance\paramno by 1\relax
  7713. \fi\next}
  7714. \let\endargs@\relax
  7715. \let\nil@\relax
  7716. \def\nilm@{\nil@}%
  7717. \long\def\nillm@{\nil@}%
  7718. % This macro is expanded during the Texinfo macro expansion, not during its
  7719. % definition. It gets all the arguments' values and assigns them to macros
  7720. % macarg.ARGNAME
  7721. %
  7722. % #1 is the macro name
  7723. % #2 is the list of argument names
  7724. % #3 is the list of argument values
  7725. \def\getargvals@#1#2#3{%
  7726. \def\macargdeflist@{}%
  7727. \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion.
  7728. \def\paramlist{#2,\nil@}%
  7729. \def\macroname{#1}%
  7730. \begingroup
  7731. \macroargctxt
  7732. \def\argvaluelist{#3,\nil@}%
  7733. \def\@tempa{#3}%
  7734. \ifx\@tempa\empty
  7735. \setemptyargvalues@
  7736. \else
  7737. \getargvals@@
  7738. \fi
  7739. }
  7740. \def\getargvals@@{%
  7741. \ifx\paramlist\nilm@
  7742. % Some sanity check needed here that \argvaluelist is also empty.
  7743. \ifx\argvaluelist\nillm@
  7744. \else
  7745. \errhelp = \EMsimple
  7746. \errmessage{Too many arguments in macro `\macroname'!}%
  7747. \fi
  7748. \let\next\macargexpandinbody@
  7749. \else
  7750. \ifx\argvaluelist\nillm@
  7751. % No more arguments values passed to macro. Set remaining named-arg
  7752. % macros to empty.
  7753. \let\next\setemptyargvalues@
  7754. \else
  7755. % pop current arg name into \@tempb
  7756. \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}%
  7757. \expandafter\@tempa\expandafter{\paramlist}%
  7758. % pop current argument value into \@tempc
  7759. \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}%
  7760. \expandafter\@tempa\expandafter{\argvaluelist}%
  7761. % Here \@tempb is the current arg name and \@tempc is the current arg value.
  7762. % First place the new argument macro definition into \@tempd
  7763. \expandafter\macname\expandafter{\@tempc}%
  7764. \expandafter\let\csname macarg.\@tempb\endcsname\relax
  7765. \expandafter\def\expandafter\@tempe\expandafter{%
  7766. \csname macarg.\@tempb\endcsname}%
  7767. \edef\@tempd{\long\def\@tempe{\the\macname}}%
  7768. \push@\@tempd\macargdeflist@
  7769. \let\next\getargvals@@
  7770. \fi
  7771. \fi
  7772. \next
  7773. }
  7774. \def\push@#1#2{%
  7775. \expandafter\expandafter\expandafter\def
  7776. \expandafter\expandafter\expandafter#2%
  7777. \expandafter\expandafter\expandafter{%
  7778. \expandafter#1#2}%
  7779. }
  7780. % Replace arguments by their values in the macro body, and place the result
  7781. % in macro \@tempa.
  7782. %
  7783. \def\macvalstoargs@{%
  7784. % To do this we use the property that token registers that are \the'ed
  7785. % within an \edef expand only once. So we are going to place all argument
  7786. % values into respective token registers.
  7787. %
  7788. % First we save the token context, and initialize argument numbering.
  7789. \begingroup
  7790. \paramno0\relax
  7791. % Then, for each argument number #N, we place the corresponding argument
  7792. % value into a new token list register \toks#N
  7793. \expandafter\putargsintokens@\saveparamlist@,;,%
  7794. % Then, we expand the body so that argument are replaced by their
  7795. % values. The trick for values not to be expanded themselves is that they
  7796. % are within tokens and that tokens expand only once in an \edef .
  7797. \edef\@tempc{\csname mac.\macroname .body\endcsname}%
  7798. % Now we restore the token stack pointer to free the token list registers
  7799. % which we have used, but we make sure that expanded body is saved after
  7800. % group.
  7801. \expandafter
  7802. \endgroup
  7803. \expandafter\def\expandafter\@tempa\expandafter{\@tempc}%
  7804. }
  7805. % Define the named-macro outside of this group and then close this group.
  7806. %
  7807. \def\macargexpandinbody@{%
  7808. \expandafter
  7809. \endgroup
  7810. \macargdeflist@
  7811. % First the replace in body the macro arguments by their values, the result
  7812. % is in \@tempa .
  7813. \macvalstoargs@
  7814. % Then we point at the \norecurse or \gobble (for recursive) macro value
  7815. % with \@tempb .
  7816. \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname
  7817. % Depending on whether it is recursive or not, we need some tailing
  7818. % \egroup .
  7819. \ifx\@tempb\gobble
  7820. \let\@tempc\relax
  7821. \else
  7822. \let\@tempc\egroup
  7823. \fi
  7824. % And now we do the real job:
  7825. \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}%
  7826. \@tempd
  7827. }
  7828. \def\putargsintokens@#1,{%
  7829. \if#1;\let\next\relax
  7830. \else
  7831. \let\next\putargsintokens@
  7832. % First we allocate the new token list register, and give it a temporary
  7833. % alias \@tempb .
  7834. \toksdef\@tempb\the\paramno
  7835. % Then we place the argument value into that token list register.
  7836. \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname
  7837. \expandafter\@tempb\expandafter{\@tempa}%
  7838. \advance\paramno by 1\relax
  7839. \fi
  7840. \next
  7841. }
  7842. % Trailing missing arguments are set to empty.
  7843. %
  7844. \def\setemptyargvalues@{%
  7845. \ifx\paramlist\nilm@
  7846. \let\next\macargexpandinbody@
  7847. \else
  7848. \expandafter\setemptyargvaluesparser@\paramlist\endargs@
  7849. \let\next\setemptyargvalues@
  7850. \fi
  7851. \next
  7852. }
  7853. \def\setemptyargvaluesparser@#1,#2\endargs@{%
  7854. \expandafter\def\expandafter\@tempa\expandafter{%
  7855. \expandafter\def\csname macarg.#1\endcsname{}}%
  7856. \push@\@tempa\macargdeflist@
  7857. \def\paramlist{#2}%
  7858. }
  7859. % #1 is the element target macro
  7860. % #2 is the list macro
  7861. % #3,#4\endargs@ is the list value
  7862. \def\pop@#1#2#3,#4\endargs@{%
  7863. \def#1{#3}%
  7864. \def#2{#4}%
  7865. }
  7866. \long\def\longpop@#1#2#3,#4\endargs@{%
  7867. \long\def#1{#3}%
  7868. \long\def#2{#4}%
  7869. }
  7870. %%%%%%%%%%%%%% End of code for > 10 arguments %%%%%%%%%%%%%%%%%%
  7871. % This defines a Texinfo @macro or @rmacro, called by \parsemacbody.
  7872. % \macrobody has the body of the macro in it, with placeholders for
  7873. % its parameters, looking like "\xeatspaces{\hash 1}".
  7874. % \paramno is the number of parameters
  7875. % \paramlist is a TeX parameter text, e.g. "#1,#2,#3,"
  7876. % There are four cases: macros of zero, one, up to nine, and many arguments.
  7877. % \xdef is used so that macro definitions will survive the file
  7878. % they're defined in: @include reads the file inside a group.
  7879. %
  7880. \def\defmacro{%
  7881. \let\hash=##% convert placeholders to macro parameter chars
  7882. \ifnum\paramno=1
  7883. \def\xeatspaces##1{##1}%
  7884. % This removes the pair of braces around the argument. We don't
  7885. % use \eatspaces, because this can cause ends of lines to be lost
  7886. % when the argument to \eatspaces is read, leading to line-based
  7887. % commands like "@itemize" not being read correctly.
  7888. \else
  7889. \let\xeatspaces\relax % suppress expansion
  7890. \fi
  7891. \ifcase\paramno
  7892. % 0
  7893. \expandafter\xdef\csname\the\macname\endcsname{%
  7894. \bgroup
  7895. \noexpand\spaceisspace
  7896. \noexpand\endlineisspace
  7897. \noexpand\expandafter % skip any whitespace after the macro name.
  7898. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7899. \expandafter\xdef\csname\the\macname @@@\endcsname{%
  7900. \egroup
  7901. \noexpand\scanmacro{\macrobody}}%
  7902. \or % 1
  7903. \expandafter\xdef\csname\the\macname\endcsname{%
  7904. \bgroup
  7905. \noexpand\braceorline
  7906. \expandafter\noexpand\csname\the\macname @@@\endcsname}%
  7907. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7908. \egroup
  7909. \noexpand\scanmacro{\macrobody}%
  7910. }%
  7911. \else % at most 9
  7912. \ifnum\paramno<10\relax
  7913. % @MACNAME sets the context for reading the macro argument
  7914. % @MACNAME@@ gets the argument, processes backslashes and appends a
  7915. % comma.
  7916. % @MACNAME@@@ removes braces surrounding the argument list.
  7917. % @MACNAME@@@@ scans the macro body with arguments substituted.
  7918. \expandafter\xdef\csname\the\macname\endcsname{%
  7919. \bgroup
  7920. \noexpand\expandafter % This \expandafter skip any spaces after the
  7921. \noexpand\macroargctxt % macro before we change the catcode of space.
  7922. \noexpand\expandafter
  7923. \expandafter\noexpand\csname\the\macname @@\endcsname}%
  7924. \expandafter\xdef\csname\the\macname @@\endcsname##1{%
  7925. \noexpand\passargtomacro
  7926. \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
  7927. \expandafter\xdef\csname\the\macname @@@\endcsname##1{%
  7928. \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
  7929. \expandafter\expandafter
  7930. \expandafter\xdef
  7931. \expandafter\expandafter
  7932. \csname\the\macname @@@@\endcsname\paramlist{%
  7933. \egroup\noexpand\scanmacro{\macrobody}}%
  7934. \else % 10 or more:
  7935. \expandafter\xdef\csname\the\macname\endcsname{%
  7936. \noexpand\getargvals@{\the\macname}{\argl}%
  7937. }%
  7938. \global\expandafter\let\csname mac.\the\macname .body\endcsname\macrobody
  7939. \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble
  7940. \fi
  7941. \fi}
  7942. \catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
  7943. \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
  7944. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  7945. %
  7946. {\catcode`\@=0 \catcode`\\=13 % We need to manipulate \ so use @ as escape
  7947. @catcode`@_=11 % private names
  7948. @catcode`@!=11 % used as argument separator
  7949. % \passargtomacro#1#2 -
  7950. % Call #1 with a list of tokens #2, with any doubled backslashes in #2
  7951. % compressed to one.
  7952. %
  7953. % This implementation works by expansion, and not execution (so we cannot use
  7954. % \def or similar). This reduces the risk of this failing in contexts where
  7955. % complete expansion is done with no execution (for example, in writing out to
  7956. % an auxiliary file for an index entry).
  7957. %
  7958. % State is kept in the input stream: the argument passed to
  7959. % @look_ahead, @gobble_and_check_finish and @add_segment is
  7960. %
  7961. % THE_MACRO ARG_RESULT ! {PENDING_BS} NEXT_TOKEN (... rest of input)
  7962. %
  7963. % where:
  7964. % THE_MACRO - name of the macro we want to call
  7965. % ARG_RESULT - argument list we build to pass to that macro
  7966. % PENDING_BS - either a backslash or nothing
  7967. % NEXT_TOKEN - used to look ahead in the input stream to see what's coming next
  7968. @gdef@passargtomacro#1#2{%
  7969. @add_segment #1!{}@relax#2\@_finish\%
  7970. }
  7971. @gdef@_finish{@_finishx} @global@let@_finishx@relax
  7972. % #1 - THE_MACRO ARG_RESULT
  7973. % #2 - PENDING_BS
  7974. % #3 - NEXT_TOKEN
  7975. % #4 used to look ahead
  7976. %
  7977. % If the next token is not a backslash, process the rest of the argument;
  7978. % otherwise, remove the next token.
  7979. @gdef@look_ahead#1!#2#3#4{%
  7980. @ifx#4\%
  7981. @expandafter@gobble_and_check_finish
  7982. @else
  7983. @expandafter@add_segment
  7984. @fi#1!{#2}#4#4%
  7985. }
  7986. % #1 - THE_MACRO ARG_RESULT
  7987. % #2 - PENDING_BS
  7988. % #3 - NEXT_TOKEN
  7989. % #4 should be a backslash, which is gobbled.
  7990. % #5 looks ahead
  7991. %
  7992. % Double backslash found. Add a single backslash, and look ahead.
  7993. @gdef@gobble_and_check_finish#1!#2#3#4#5{%
  7994. @add_segment#1\!{}#5#5%
  7995. }
  7996. @gdef@is_fi{@fi}
  7997. % #1 - THE_MACRO ARG_RESULT
  7998. % #2 - PENDING_BS
  7999. % #3 - NEXT_TOKEN
  8000. % #4 is input stream until next backslash
  8001. %
  8002. % Input stream is either at the start of the argument, or just after a
  8003. % backslash sequence, either a lone backslash, or a doubled backslash.
  8004. % NEXT_TOKEN contains the first token in the input stream: if it is \finish,
  8005. % finish; otherwise, append to ARG_RESULT the segment of the argument up until
  8006. % the next backslash. PENDING_BACKSLASH contains a backslash to represent
  8007. % a backslash just before the start of the input stream that has not been
  8008. % added to ARG_RESULT.
  8009. @gdef@add_segment#1!#2#3#4\{%
  8010. @ifx#3@_finish
  8011. @call_the_macro#1!%
  8012. @else
  8013. % append the pending backslash to the result, followed by the next segment
  8014. @expandafter@is_fi@look_ahead#1#2#4!{\}@fi
  8015. % this @fi is discarded by @look_ahead.
  8016. % we can't get rid of it with \expandafter because we don't know how
  8017. % long #4 is.
  8018. }
  8019. % #1 - THE_MACRO
  8020. % #2 - ARG_RESULT
  8021. % #3 discards the res of the conditional in @add_segment, and @is_fi ends the
  8022. % conditional.
  8023. @gdef@call_the_macro#1#2!#3@fi{@is_fi #1{#2}}
  8024. }
  8025. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  8026. % \braceorline MAC is used for a one-argument macro MAC. It checks
  8027. % whether the next non-whitespace character is a {. It sets the context
  8028. % for reading the argument (slightly different in the two cases). Then,
  8029. % to read the argument, in the whole-line case, it then calls the regular
  8030. % \parsearg MAC; in the lbrace case, it calls \passargtomacro MAC.
  8031. %
  8032. \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx}
  8033. \def\braceorlinexxx{%
  8034. \ifx\nchar\bgroup
  8035. \macroargctxt
  8036. \expandafter\passargtomacro
  8037. \else
  8038. \macrolineargctxt\expandafter\parsearg
  8039. \fi \macnamexxx}
  8040. % @alias.
  8041. % We need some trickery to remove the optional spaces around the equal
  8042. % sign. Make them active and then expand them all to nothing.
  8043. %
  8044. \def\alias{\parseargusing\obeyspaces\aliasxxx}
  8045. \def\aliasxxx #1{\aliasyyy#1\relax}
  8046. \def\aliasyyy #1=#2\relax{%
  8047. {%
  8048. \expandafter\let\obeyedspace=\empty
  8049. \addtomacrolist{#1}%
  8050. \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}%
  8051. }%
  8052. \next
  8053. }
  8054. \message{cross references,}
  8055. \newwrite\auxfile
  8056. \newif\ifhavexrefs % True if xref values are known.
  8057. \newif\ifwarnedxrefs % True if we warned once that they aren't known.
  8058. % @inforef is relatively simple.
  8059. \def\inforef #1{\inforefzzz #1,,,,**}
  8060. \def\inforefzzz #1,#2,#3,#4**{%
  8061. \putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  8062. node \samp{\ignorespaces#1{}}}
  8063. % @node's only job in TeX is to define \lastnode, which is used in
  8064. % cross-references. The @node line might or might not have commas, and
  8065. % might or might not have spaces before the first comma, like:
  8066. % @node foo , bar , ...
  8067. % We don't want such trailing spaces in the node name.
  8068. %
  8069. \parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse}
  8070. %
  8071. % also remove a trailing comma, in case of something like this:
  8072. % @node Help-Cross, , , Cross-refs
  8073. \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
  8074. \def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
  8075. \let\nwnode=\node
  8076. \let\lastnode=\empty
  8077. % Write a cross-reference definition for the current node. #1 is the
  8078. % type (Ynumbered, Yappendix, Ynothing).
  8079. %
  8080. \def\donoderef#1{%
  8081. \ifx\lastnode\empty\else
  8082. \setref{\lastnode}{#1}%
  8083. \global\let\lastnode=\empty
  8084. \fi
  8085. }
  8086. % @anchor{NAME} -- define xref target at arbitrary point.
  8087. %
  8088. \newcount\savesfregister
  8089. %
  8090. \def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
  8091. \def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
  8092. \def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
  8093. % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
  8094. % anchor), which consists of three parts:
  8095. % 1) NAME-title - the current sectioning name taken from \lastsection,
  8096. % or the anchor name.
  8097. % 2) NAME-snt - section number and type, passed as the SNT arg, or
  8098. % empty for anchors.
  8099. % 3) NAME-pg - the page number.
  8100. %
  8101. % This is called from \donoderef, \anchor, and \dofloat. In the case of
  8102. % floats, there is an additional part, which is not written here:
  8103. % 4) NAME-lof - the text as it should appear in a @listoffloats.
  8104. %
  8105. \def\setref#1#2{%
  8106. \pdfmkdest{#1}%
  8107. \iflinks
  8108. {%
  8109. \requireauxfile
  8110. \atdummies % preserve commands, but don't expand them
  8111. % match definition in \xrdef, \refx, \xrefX.
  8112. \def\value##1{##1}%
  8113. \edef\writexrdef##1##2{%
  8114. \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
  8115. ##1}{##2}}% these are parameters of \writexrdef
  8116. }%
  8117. \toks0 = \expandafter{\lastsection}%
  8118. \immediate \writexrdef{title}{\the\toks0 }%
  8119. \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
  8120. \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
  8121. }%
  8122. \fi
  8123. }
  8124. % @xrefautosectiontitle on|off says whether @section(ing) names are used
  8125. % automatically in xrefs, if the third arg is not explicitly specified.
  8126. % This was provided as a "secret" @set xref-automatic-section-title
  8127. % variable, now it's official.
  8128. %
  8129. \parseargdef\xrefautomaticsectiontitle{%
  8130. \def\temp{#1}%
  8131. \ifx\temp\onword
  8132. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8133. = \empty
  8134. \else\ifx\temp\offword
  8135. \expandafter\let\csname SETxref-automatic-section-title\endcsname
  8136. = \relax
  8137. \else
  8138. \errhelp = \EMsimple
  8139. \errmessage{Unknown @xrefautomaticsectiontitle value `\temp',
  8140. must be on|off}%
  8141. \fi\fi
  8142. }
  8143. %
  8144. % @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is
  8145. % the node name, #2 the name of the Info cross-reference, #3 the printed
  8146. % node name, #4 the name of the Info file, #5 the name of the printed
  8147. % manual. All but the node name can be omitted.
  8148. %
  8149. \def\pxref{\putwordsee{} \xrefXX}
  8150. \def\xref{\putwordSee{} \xrefXX}
  8151. \def\ref{\xrefXX}
  8152. \def\xrefXX#1{\def\xrefXXarg{#1}\futurelet\tokenafterxref\xrefXXX}
  8153. \def\xrefXXX{\expandafter\xrefX\expandafter[\xrefXXarg,,,,,,,]}
  8154. %
  8155. \newbox\toprefbox
  8156. \newbox\printedrefnamebox
  8157. \newbox\infofilenamebox
  8158. \newbox\printedmanualbox
  8159. %
  8160. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  8161. \unsepspaces
  8162. %
  8163. % Get args without leading/trailing spaces.
  8164. \def\printedrefname{\ignorespaces #3}%
  8165. \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
  8166. %
  8167. \def\infofilename{\ignorespaces #4}%
  8168. \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
  8169. %
  8170. \def\printedmanual{\ignorespaces #5}%
  8171. \setbox\printedmanualbox = \hbox{\printedmanual\unskip}%
  8172. %
  8173. % If the printed reference name (arg #3) was not explicitly given in
  8174. % the @xref, figure out what we want to use.
  8175. \ifdim \wd\printedrefnamebox = 0pt
  8176. % No printed node name was explicitly given.
  8177. \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
  8178. % Not auto section-title: use node name inside the square brackets.
  8179. \def\printedrefname{\ignorespaces #1}%
  8180. \else
  8181. % Auto section-title: use chapter/section title inside
  8182. % the square brackets if we have it.
  8183. \ifdim \wd\printedmanualbox > 0pt
  8184. % It is in another manual, so we don't have it; use node name.
  8185. \def\printedrefname{\ignorespaces #1}%
  8186. \else
  8187. \ifhavexrefs
  8188. % We (should) know the real title if we have the xref values.
  8189. \def\printedrefname{\refx{#1-title}{}}%
  8190. \else
  8191. % Otherwise just copy the Info node name.
  8192. \def\printedrefname{\ignorespaces #1}%
  8193. \fi%
  8194. \fi
  8195. \fi
  8196. \fi
  8197. %
  8198. % Make link in pdf output.
  8199. \ifpdf
  8200. % For pdfTeX and LuaTeX
  8201. {\indexnofonts
  8202. \makevalueexpandable
  8203. \turnoffactive
  8204. % This expands tokens, so do it after making catcode changes, so _
  8205. % etc. don't get their TeX definitions. This ignores all spaces in
  8206. % #4, including (wrongly) those in the middle of the filename.
  8207. \getfilename{#4}%
  8208. %
  8209. % This (wrongly) does not take account of leading or trailing
  8210. % spaces in #1, which should be ignored.
  8211. \setpdfdestname{#1}%
  8212. %
  8213. \ifx\pdfdestname\empty
  8214. \def\pdfdestname{Top}% no empty targets
  8215. \fi
  8216. %
  8217. \leavevmode
  8218. \startlink attr{/Border [0 0 0]}%
  8219. \ifnum\filenamelength>0
  8220. goto file{\the\filename.pdf} name{\pdfdestname}%
  8221. \else
  8222. goto name{\pdfmkpgn{\pdfdestname}}%
  8223. \fi
  8224. }%
  8225. \setcolor{\linkcolor}%
  8226. \else
  8227. \ifx\XeTeXrevision\thisisundefined
  8228. \else
  8229. % For XeTeX
  8230. {\indexnofonts
  8231. \makevalueexpandable
  8232. \turnoffactive
  8233. % This expands tokens, so do it after making catcode changes, so _
  8234. % etc. don't get their TeX definitions. This ignores all spaces in
  8235. % #4, including (wrongly) those in the middle of the filename.
  8236. \getfilename{#4}%
  8237. %
  8238. % This (wrongly) does not take account of leading or trailing
  8239. % spaces in #1, which should be ignored.
  8240. \setpdfdestname{#1}%
  8241. %
  8242. \ifx\pdfdestname\empty
  8243. \def\pdfdestname{Top}% no empty targets
  8244. \fi
  8245. %
  8246. \leavevmode
  8247. \ifnum\filenamelength>0
  8248. % With default settings,
  8249. % XeTeX (xdvipdfmx) replaces link destination names with integers.
  8250. % In this case, the replaced destination names of
  8251. % remote PDFs are no longer known. In order to avoid a replacement,
  8252. % you can use xdvipdfmx's command line option `-C 0x0010'.
  8253. % If you use XeTeX 0.99996+ (TeX Live 2016+),
  8254. % this command line option is no longer necessary
  8255. % because we can use the `dvipdfmx:config' special.
  8256. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8257. << /S /GoToR /F (\the\filename.pdf) /D (\pdfdestname) >> >>}%
  8258. \else
  8259. \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
  8260. << /S /GoTo /D (\pdfdestname) >> >>}%
  8261. \fi
  8262. }%
  8263. \setcolor{\linkcolor}%
  8264. \fi
  8265. \fi
  8266. {%
  8267. % Have to otherify everything special to allow the \csname to
  8268. % include an _ in the xref name, etc.
  8269. \indexnofonts
  8270. \turnoffactive
  8271. \def\value##1{##1}%
  8272. \expandafter\global\expandafter\let\expandafter\Xthisreftitle
  8273. \csname XR#1-title\endcsname
  8274. }%
  8275. %
  8276. % Float references are printed completely differently: "Figure 1.2"
  8277. % instead of "[somenode], p.3". \iffloat distinguishes them by
  8278. % \Xthisreftitle being set to a magic string.
  8279. \iffloat\Xthisreftitle
  8280. % If the user specified the print name (third arg) to the ref,
  8281. % print it instead of our usual "Figure 1.2".
  8282. \ifdim\wd\printedrefnamebox = 0pt
  8283. \refx{#1-snt}{}%
  8284. \else
  8285. \printedrefname
  8286. \fi
  8287. %
  8288. % If the user also gave the printed manual name (fifth arg), append
  8289. % "in MANUALNAME".
  8290. \ifdim \wd\printedmanualbox > 0pt
  8291. \space \putwordin{} \cite{\printedmanual}%
  8292. \fi
  8293. \else
  8294. % node/anchor (non-float) references.
  8295. %
  8296. % If we use \unhbox to print the node names, TeX does not insert
  8297. % empty discretionaries after hyphens, which means that it will not
  8298. % find a line break at a hyphen in a node names. Since some manuals
  8299. % are best written with fairly long node names, containing hyphens,
  8300. % this is a loss. Therefore, we give the text of the node name
  8301. % again, so it is as if TeX is seeing it for the first time.
  8302. %
  8303. \ifdim \wd\printedmanualbox > 0pt
  8304. % Cross-manual reference with a printed manual name.
  8305. %
  8306. \crossmanualxref{\cite{\printedmanual\unskip}}%
  8307. %
  8308. \else\ifdim \wd\infofilenamebox > 0pt
  8309. % Cross-manual reference with only an info filename (arg 4), no
  8310. % printed manual name (arg 5). This is essentially the same as
  8311. % the case above; we output the filename, since we have nothing else.
  8312. %
  8313. \crossmanualxref{\code{\infofilename\unskip}}%
  8314. %
  8315. \else
  8316. % Reference within this manual.
  8317. %
  8318. % _ (for example) has to be the character _ for the purposes of the
  8319. % control sequence corresponding to the node, but it has to expand
  8320. % into the usual \leavevmode...\vrule stuff for purposes of
  8321. % printing. So we \turnoffactive for the \refx-snt, back on for the
  8322. % printing, back off for the \refx-pg.
  8323. {\turnoffactive
  8324. % Only output a following space if the -snt ref is nonempty; for
  8325. % @unnumbered and @anchor, it won't be.
  8326. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
  8327. \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
  8328. }%
  8329. % output the `[mynode]' via the macro below so it can be overridden.
  8330. \xrefprintnodename\printedrefname
  8331. %
  8332. % But we always want a comma and a space:
  8333. ,\space
  8334. %
  8335. % output the `page 3'.
  8336. \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  8337. % Add a , if xref followed by a space
  8338. \if\space\noexpand\tokenafterxref ,%
  8339. \else\ifx\ \tokenafterxref ,% @TAB
  8340. \else\ifx\*\tokenafterxref ,% @*
  8341. \else\ifx\ \tokenafterxref ,% @SPACE
  8342. \else\ifx\
  8343. \tokenafterxref ,% @NL
  8344. \else\ifx\tie\tokenafterxref ,% @tie
  8345. \fi\fi\fi\fi\fi\fi
  8346. \fi\fi
  8347. \fi
  8348. \endlink
  8349. \endgroup}
  8350. % Output a cross-manual xref to #1. Used just above (twice).
  8351. %
  8352. % Only include the text "Section ``foo'' in" if the foo is neither
  8353. % missing or Top. Thus, @xref{,,,foo,The Foo Manual} outputs simply
  8354. % "see The Foo Manual", the idea being to refer to the whole manual.
  8355. %
  8356. % But, this being TeX, we can't easily compare our node name against the
  8357. % string "Top" while ignoring the possible spaces before and after in
  8358. % the input. By adding the arbitrary 7sp below, we make it much less
  8359. % likely that a real node name would have the same width as "Top" (e.g.,
  8360. % in a monospaced font). Hopefully it will never happen in practice.
  8361. %
  8362. % For the same basic reason, we retypeset the "Top" at every
  8363. % reference, since the current font is indeterminate.
  8364. %
  8365. \def\crossmanualxref#1{%
  8366. \setbox\toprefbox = \hbox{Top\kern7sp}%
  8367. \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
  8368. \ifdim \wd2 > 7sp % nonempty?
  8369. \ifdim \wd2 = \wd\toprefbox \else % same as Top?
  8370. \putwordSection{} ``\printedrefname'' \putwordin{}\space
  8371. \fi
  8372. \fi
  8373. #1%
  8374. }
  8375. % This macro is called from \xrefX for the `[nodename]' part of xref
  8376. % output. It's a separate macro only so it can be changed more easily,
  8377. % since square brackets don't work well in some documents. Particularly
  8378. % one that Bob is working on :).
  8379. %
  8380. \def\xrefprintnodename#1{[#1]}
  8381. % Things referred to by \setref.
  8382. %
  8383. \def\Ynothing{}
  8384. \def\Yomitfromtoc{}
  8385. \def\Ynumbered{%
  8386. \ifnum\secno=0
  8387. \putwordChapter@tie \the\chapno
  8388. \else \ifnum\subsecno=0
  8389. \putwordSection@tie \the\chapno.\the\secno
  8390. \else \ifnum\subsubsecno=0
  8391. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno
  8392. \else
  8393. \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno
  8394. \fi\fi\fi
  8395. }
  8396. \def\Yappendix{%
  8397. \ifnum\secno=0
  8398. \putwordAppendix@tie @char\the\appendixno{}%
  8399. \else \ifnum\subsecno=0
  8400. \putwordSection@tie @char\the\appendixno.\the\secno
  8401. \else \ifnum\subsubsecno=0
  8402. \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno
  8403. \else
  8404. \putwordSection@tie
  8405. @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno
  8406. \fi\fi\fi
  8407. }
  8408. % \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
  8409. % is output afterwards if non-empty.
  8410. \def\refx#1#2{%
  8411. \requireauxfile
  8412. {%
  8413. \indexnofonts
  8414. \otherbackslash
  8415. \def\value##1{##1}%
  8416. \expandafter\global\expandafter\let\expandafter\thisrefX
  8417. \csname XR#1\endcsname
  8418. }%
  8419. \ifx\thisrefX\relax
  8420. % If not defined, say something at least.
  8421. \angleleft un\-de\-fined\angleright
  8422. \iflinks
  8423. \ifhavexrefs
  8424. {\toks0 = {#1}% avoid expansion of possibly-complex value
  8425. \message{\linenumber Undefined cross reference `\the\toks0'.}}%
  8426. \else
  8427. \ifwarnedxrefs\else
  8428. \global\warnedxrefstrue
  8429. \message{Cross reference values unknown; you must run TeX again.}%
  8430. \fi
  8431. \fi
  8432. \fi
  8433. \else
  8434. % It's defined, so just use it.
  8435. \thisrefX
  8436. \fi
  8437. #2% Output the suffix in any case.
  8438. }
  8439. % This is the macro invoked by entries in the aux file. Define a control
  8440. % sequence for a cross-reference target (we prepend XR to the control sequence
  8441. % name to avoid collisions). The value is the page number. If this is a float
  8442. % type, we have more work to do.
  8443. %
  8444. \def\xrdef#1#2{%
  8445. {% Expand the node or anchor name to remove control sequences.
  8446. % \turnoffactive stops 8-bit characters being changed to commands
  8447. % like @'e. \refx does the same to retrieve the value in the definition.
  8448. \indexnofonts
  8449. \turnoffactive
  8450. \def\value##1{##1}%
  8451. \xdef\safexrefname{#1}%
  8452. }%
  8453. %
  8454. \bgroup
  8455. \expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
  8456. \egroup
  8457. % We put the \gdef inside a group to avoid the definitions building up on
  8458. % TeX's save stack, which can cause it to run out of space for aux files with
  8459. % thousands of lines. \gdef doesn't use the save stack, but \csname does
  8460. % when it defines an unknown control sequence as \relax.
  8461. %
  8462. % Was that xref control sequence that we just defined for a float?
  8463. \expandafter\iffloat\csname XR\safexrefname\endcsname
  8464. % it was a float, and we have the (safe) float type in \iffloattype.
  8465. \expandafter\let\expandafter\floatlist
  8466. \csname floatlist\iffloattype\endcsname
  8467. %
  8468. % Is this the first time we've seen this float type?
  8469. \expandafter\ifx\floatlist\relax
  8470. \toks0 = {\do}% yes, so just \do
  8471. \else
  8472. % had it before, so preserve previous elements in list.
  8473. \toks0 = \expandafter{\floatlist\do}%
  8474. \fi
  8475. %
  8476. % Remember this xref in the control sequence \floatlistFLOATTYPE,
  8477. % for later use in \listoffloats.
  8478. \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0
  8479. {\safexrefname}}%
  8480. \fi
  8481. }
  8482. % If working on a large document in chapters, it is convenient to
  8483. % be able to disable indexing, cross-referencing, and contents, for test runs.
  8484. % This is done with @novalidate at the beginning of the file.
  8485. %
  8486. \newif\iflinks \linkstrue % by default we want the aux files.
  8487. \let\novalidate = \linksfalse
  8488. % Used when writing to the aux file, or when using data from it.
  8489. \def\requireauxfile{%
  8490. \iflinks
  8491. \tryauxfile
  8492. % Open the new aux file. TeX will close it automatically at exit.
  8493. \immediate\openout\auxfile=\jobname.aux
  8494. \fi
  8495. \global\let\requireauxfile=\relax % Only do this once.
  8496. }
  8497. % Read the last existing aux file, if any. No error if none exists.
  8498. %
  8499. \def\tryauxfile{%
  8500. \openin 1 \jobname.aux
  8501. \ifeof 1 \else
  8502. \readdatafile{aux}%
  8503. \global\havexrefstrue
  8504. \fi
  8505. \closein 1
  8506. }
  8507. \def\setupdatafile{%
  8508. \catcode`\^^@=\other
  8509. \catcode`\^^A=\other
  8510. \catcode`\^^B=\other
  8511. \catcode`\^^C=\other
  8512. \catcode`\^^D=\other
  8513. \catcode`\^^E=\other
  8514. \catcode`\^^F=\other
  8515. \catcode`\^^G=\other
  8516. \catcode`\^^H=\other
  8517. \catcode`\^^K=\other
  8518. \catcode`\^^L=\other
  8519. \catcode`\^^N=\other
  8520. \catcode`\^^P=\other
  8521. \catcode`\^^Q=\other
  8522. \catcode`\^^R=\other
  8523. \catcode`\^^S=\other
  8524. \catcode`\^^T=\other
  8525. \catcode`\^^U=\other
  8526. \catcode`\^^V=\other
  8527. \catcode`\^^W=\other
  8528. \catcode`\^^X=\other
  8529. \catcode`\^^Z=\other
  8530. \catcode`\^^[=\other
  8531. \catcode`\^^\=\other
  8532. \catcode`\^^]=\other
  8533. \catcode`\^^^=\other
  8534. \catcode`\^^_=\other
  8535. % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
  8536. % in xref tags, i.e., node names. But since ^^e4 notation isn't
  8537. % supported in the main text, it doesn't seem desirable. Furthermore,
  8538. % that is not enough: for node names that actually contain a ^
  8539. % character, we would end up writing a line like this: 'xrdef {'hat
  8540. % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
  8541. % argument, and \hat is not an expandable control sequence. It could
  8542. % all be worked out, but why? Either we support ^^ or we don't.
  8543. %
  8544. % The other change necessary for this was to define \auxhat:
  8545. % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
  8546. % and then to call \auxhat in \setq.
  8547. %
  8548. \catcode`\^=\other
  8549. %
  8550. % Special characters. Should be turned off anyway, but...
  8551. \catcode`\~=\other
  8552. \catcode`\[=\other
  8553. \catcode`\]=\other
  8554. \catcode`\"=\other
  8555. \catcode`\_=\other
  8556. \catcode`\|=\other
  8557. \catcode`\<=\other
  8558. \catcode`\>=\other
  8559. \catcode`\$=\other
  8560. \catcode`\#=\other
  8561. \catcode`\&=\other
  8562. \catcode`\%=\other
  8563. \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
  8564. %
  8565. % This is to support \ in node names and titles, since the \
  8566. % characters end up in a \csname. It's easier than
  8567. % leaving it active and making its active definition an actual \
  8568. % character. What I don't understand is why it works in the *value*
  8569. % of the xrdef. Seems like it should be a catcode12 \, and that
  8570. % should not typeset properly. But it works, so I'm moving on for
  8571. % now. --karl, 15jan04.
  8572. \catcode`\\=\other
  8573. %
  8574. % @ is our escape character in .aux files, and we need braces.
  8575. \catcode`\{=1
  8576. \catcode`\}=2
  8577. \catcode`\@=0
  8578. }
  8579. \def\readdatafile#1{%
  8580. \begingroup
  8581. \setupdatafile
  8582. \input\jobname.#1
  8583. \endgroup}
  8584. \message{insertions,}
  8585. % including footnotes.
  8586. \newcount \footnoteno
  8587. % The trailing space in the following definition for supereject is
  8588. % vital for proper filling; pages come out unaligned when you do a
  8589. % pagealignmacro call if that space before the closing brace is
  8590. % removed. (Generally, numeric constants should always be followed by a
  8591. % space to prevent strange expansion errors.)
  8592. \def\supereject{\par\penalty -20000\footnoteno =0 }
  8593. % @footnotestyle is meaningful for Info output only.
  8594. \let\footnotestyle=\comment
  8595. {\catcode `\@=11
  8596. %
  8597. % Auto-number footnotes. Otherwise like plain.
  8598. \gdef\footnote{%
  8599. \global\advance\footnoteno by \@ne
  8600. \edef\thisfootno{$^{\the\footnoteno}$}%
  8601. %
  8602. % In case the footnote comes at the end of a sentence, preserve the
  8603. % extra spacing after we do the footnote number.
  8604. \let\@sf\empty
  8605. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi
  8606. %
  8607. % Remove inadvertent blank space before typesetting the footnote number.
  8608. \unskip
  8609. \thisfootno\@sf
  8610. \dofootnote
  8611. }%
  8612. % Don't bother with the trickery in plain.tex to not require the
  8613. % footnote text as a parameter. Our footnotes don't need to be so general.
  8614. %
  8615. % Oh yes, they do; otherwise, @ifset (and anything else that uses
  8616. % \parseargline) fails inside footnotes because the tokens are fixed when
  8617. % the footnote is read. --karl, 16nov96.
  8618. %
  8619. \gdef\dofootnote{%
  8620. \insert\footins\bgroup
  8621. %
  8622. % Nested footnotes are not supported in TeX, that would take a lot
  8623. % more work. (\startsavinginserts does not suffice.)
  8624. \let\footnote=\errfootnotenest
  8625. %
  8626. % We want to typeset this text as a normal paragraph, even if the
  8627. % footnote reference occurs in (for example) a display environment.
  8628. % So reset some parameters.
  8629. \hsize=\txipagewidth
  8630. \interlinepenalty\interfootnotelinepenalty
  8631. \splittopskip\ht\strutbox % top baseline for broken footnotes
  8632. \splitmaxdepth\dp\strutbox
  8633. \floatingpenalty\@MM
  8634. \leftskip\z@skip
  8635. \rightskip\z@skip
  8636. \spaceskip\z@skip
  8637. \xspaceskip\z@skip
  8638. \parindent\defaultparindent
  8639. %
  8640. \smallfonts \rm
  8641. %
  8642. % Because we use hanging indentation in footnotes, a @noindent appears
  8643. % to exdent this text, so make it be a no-op. makeinfo does not use
  8644. % hanging indentation so @noindent can still be needed within footnote
  8645. % text after an @example or the like (not that this is good style).
  8646. \let\noindent = \relax
  8647. %
  8648. % Hang the footnote text off the number. Use \everypar in case the
  8649. % footnote extends for more than one paragraph.
  8650. \everypar = {\hang}%
  8651. \textindent{\thisfootno}%
  8652. %
  8653. % Don't crash into the line above the footnote text. Since this
  8654. % expands into a box, it must come within the paragraph, lest it
  8655. % provide a place where TeX can split the footnote.
  8656. \footstrut
  8657. %
  8658. % Invoke rest of plain TeX footnote routine.
  8659. \futurelet\next\fo@t
  8660. }
  8661. }%end \catcode `\@=11
  8662. \def\errfootnotenest{%
  8663. \errhelp=\EMsimple
  8664. \errmessage{Nested footnotes not supported in texinfo.tex,
  8665. even though they work in makeinfo; sorry}
  8666. }
  8667. \def\errfootnoteheading{%
  8668. \errhelp=\EMsimple
  8669. \errmessage{Footnotes in chapters, sections, etc., are not supported}
  8670. }
  8671. % In case a @footnote appears in a vbox, save the footnote text and create
  8672. % the real \insert just after the vbox finished. Otherwise, the insertion
  8673. % would be lost.
  8674. % Similarly, if a @footnote appears inside an alignment, save the footnote
  8675. % text to a box and make the \insert when a row of the table is finished.
  8676. % And the same can be done for other insert classes. --kasal, 16nov03.
  8677. %
  8678. % Replace the \insert primitive by a cheating macro.
  8679. % Deeper inside, just make sure that the saved insertions are not spilled
  8680. % out prematurely.
  8681. %
  8682. \def\startsavinginserts{%
  8683. \ifx \insert\ptexinsert
  8684. \let\insert\saveinsert
  8685. \else
  8686. \let\checkinserts\relax
  8687. \fi
  8688. }
  8689. % This \insert replacement works for both \insert\footins{foo} and
  8690. % \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}.
  8691. %
  8692. \def\saveinsert#1{%
  8693. \edef\next{\noexpand\savetobox \makeSAVEname#1}%
  8694. \afterassignment\next
  8695. % swallow the left brace
  8696. \let\temp =
  8697. }
  8698. \def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}}
  8699. \def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1}
  8700. \def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi}
  8701. \def\placesaveins#1{%
  8702. \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname
  8703. {\box#1}%
  8704. }
  8705. % eat @SAVE -- beware, all of them have catcode \other:
  8706. {
  8707. \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-)
  8708. \gdef\gobblesave @SAVE{}
  8709. }
  8710. % initialization:
  8711. \def\newsaveins #1{%
  8712. \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}%
  8713. \next
  8714. }
  8715. \def\newsaveinsX #1{%
  8716. \csname newbox\endcsname #1%
  8717. \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts
  8718. \checksaveins #1}%
  8719. }
  8720. % initialize:
  8721. \let\checkinserts\empty
  8722. \newsaveins\footins
  8723. \newsaveins\margin
  8724. % @image. We use the macros from epsf.tex to support this.
  8725. % If epsf.tex is not installed and @image is used, we complain.
  8726. %
  8727. % Check for and read epsf.tex up front. If we read it only at @image
  8728. % time, we might be inside a group, and then its definitions would get
  8729. % undone and the next image would fail.
  8730. \openin 1 = epsf.tex
  8731. \ifeof 1 \else
  8732. % Do not bother showing banner with epsf.tex v2.7k (available in
  8733. % doc/epsf.tex and on ctan).
  8734. \def\epsfannounce{\toks0 = }%
  8735. \input epsf.tex
  8736. \fi
  8737. \closein 1
  8738. %
  8739. % We will only complain once about lack of epsf.tex.
  8740. \newif\ifwarnednoepsf
  8741. \newhelp\noepsfhelp{epsf.tex must be installed for images to
  8742. work. It is also included in the Texinfo distribution, or you can get
  8743. it from https://ctan.org/texarchive/macros/texinfo/texinfo/doc/epsf.tex.}
  8744. %
  8745. \def\image#1{%
  8746. \ifx\epsfbox\thisisundefined
  8747. \ifwarnednoepsf \else
  8748. \errhelp = \noepsfhelp
  8749. \errmessage{epsf.tex not found, images will be ignored}%
  8750. \global\warnednoepsftrue
  8751. \fi
  8752. \else
  8753. \imagexxx #1,,,,,\finish
  8754. \fi
  8755. }
  8756. %
  8757. % Arguments to @image:
  8758. % #1 is (mandatory) image filename; we tack on .eps extension.
  8759. % #2 is (optional) width, #3 is (optional) height.
  8760. % #4 is (ignored optional) html alt text.
  8761. % #5 is (ignored optional) extension.
  8762. % #6 is just the usual extra ignored arg for parsing stuff.
  8763. \newif\ifimagevmode
  8764. \def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
  8765. \catcode`\^^M = 5 % in case we're inside an example
  8766. \normalturnoffactive % allow _ et al. in names
  8767. \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
  8768. % If the image is by itself, center it.
  8769. \ifvmode
  8770. \imagevmodetrue
  8771. \else \ifx\centersub\centerV
  8772. % for @center @image, we need a vbox so we can have our vertical space
  8773. \imagevmodetrue
  8774. \vbox\bgroup % vbox has better behavior than vtop herev
  8775. \fi\fi
  8776. %
  8777. \ifimagevmode
  8778. \nobreak\medskip
  8779. % Usually we'll have text after the image which will insert
  8780. % \parskip glue, so insert it here too to equalize the space
  8781. % above and below.
  8782. \nobreak\vskip\parskip
  8783. \nobreak
  8784. \fi
  8785. %
  8786. % Leave vertical mode so that indentation from an enclosing
  8787. % environment such as @quotation is respected.
  8788. % However, if we're at the top level, we don't want the
  8789. % normal paragraph indentation.
  8790. % On the other hand, if we are in the case of @center @image, we don't
  8791. % want to start a paragraph, which will create a hsize-width box and
  8792. % eradicate the centering.
  8793. \ifx\centersub\centerV\else \noindent \fi
  8794. %
  8795. % Output the image.
  8796. \ifpdf
  8797. % For pdfTeX and LuaTeX <= 0.80
  8798. \dopdfimage{#1}{#2}{#3}%
  8799. \else
  8800. \ifx\XeTeXrevision\thisisundefined
  8801. % For epsf.tex
  8802. % \epsfbox itself resets \epsf?size at each figure.
  8803. \setbox0 = \hbox{\ignorespaces #2}%
  8804. \ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi
  8805. \setbox0 = \hbox{\ignorespaces #3}%
  8806. \ifdim\wd0 > 0pt \epsfysize=#3\relax \fi
  8807. \epsfbox{#1.eps}%
  8808. \else
  8809. % For XeTeX
  8810. \doxeteximage{#1}{#2}{#3}%
  8811. \fi
  8812. \fi
  8813. %
  8814. \ifimagevmode
  8815. \medskip % space after a standalone image
  8816. \fi
  8817. \ifx\centersub\centerV \egroup \fi
  8818. \endgroup}
  8819. % @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables,
  8820. % etc. We don't actually implement floating yet, we always include the
  8821. % float "here". But it seemed the best name for the future.
  8822. %
  8823. \envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish}
  8824. % There may be a space before second and/or third parameter; delete it.
  8825. \def\eatcommaspace#1, {#1,}
  8826. % #1 is the optional FLOATTYPE, the text label for this float, typically
  8827. % "Figure", "Table", "Example", etc. Can't contain commas. If omitted,
  8828. % this float will not be numbered and cannot be referred to.
  8829. %
  8830. % #2 is the optional xref label. Also must be present for the float to
  8831. % be referable.
  8832. %
  8833. % #3 is the optional positioning argument; for now, it is ignored. It
  8834. % will somehow specify the positions allowed to float to (here, top, bottom).
  8835. %
  8836. % We keep a separate counter for each FLOATTYPE, which we reset at each
  8837. % chapter-level command.
  8838. \let\resetallfloatnos=\empty
  8839. %
  8840. \def\dofloat#1,#2,#3,#4\finish{%
  8841. \let\thiscaption=\empty
  8842. \let\thisshortcaption=\empty
  8843. %
  8844. % don't lose footnotes inside @float.
  8845. %
  8846. % BEWARE: when the floats start float, we have to issue warning whenever an
  8847. % insert appears inside a float which could possibly float. --kasal, 26may04
  8848. %
  8849. \startsavinginserts
  8850. %
  8851. % We can't be used inside a paragraph.
  8852. \par
  8853. %
  8854. \vtop\bgroup
  8855. \def\floattype{#1}%
  8856. \def\floatlabel{#2}%
  8857. \def\floatloc{#3}% we do nothing with this yet.
  8858. %
  8859. \ifx\floattype\empty
  8860. \let\safefloattype=\empty
  8861. \else
  8862. {%
  8863. % the floattype might have accents or other special characters,
  8864. % but we need to use it in a control sequence name.
  8865. \indexnofonts
  8866. \turnoffactive
  8867. \xdef\safefloattype{\floattype}%
  8868. }%
  8869. \fi
  8870. %
  8871. % If label is given but no type, we handle that as the empty type.
  8872. \ifx\floatlabel\empty \else
  8873. % We want each FLOATTYPE to be numbered separately (Figure 1,
  8874. % Table 1, Figure 2, ...). (And if no label, no number.)
  8875. %
  8876. \expandafter\getfloatno\csname\safefloattype floatno\endcsname
  8877. \global\advance\floatno by 1
  8878. %
  8879. {%
  8880. % This magic value for \lastsection is output by \setref as the
  8881. % XREFLABEL-title value. \xrefX uses it to distinguish float
  8882. % labels (which have a completely different output format) from
  8883. % node and anchor labels. And \xrdef uses it to construct the
  8884. % lists of floats.
  8885. %
  8886. \edef\lastsection{\floatmagic=\safefloattype}%
  8887. \setref{\floatlabel}{Yfloat}%
  8888. }%
  8889. \fi
  8890. %
  8891. % start with \parskip glue, I guess.
  8892. \vskip\parskip
  8893. %
  8894. % Don't suppress indentation if a float happens to start a section.
  8895. \restorefirstparagraphindent
  8896. }
  8897. % we have these possibilities:
  8898. % @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap
  8899. % @float Foo,lbl & no caption: Foo 1.1
  8900. % @float Foo & @caption{Cap}: Foo: Cap
  8901. % @float Foo & no caption: Foo
  8902. % @float ,lbl & Caption{Cap}: 1.1: Cap
  8903. % @float ,lbl & no caption: 1.1
  8904. % @float & @caption{Cap}: Cap
  8905. % @float & no caption:
  8906. %
  8907. \def\Efloat{%
  8908. \let\floatident = \empty
  8909. %
  8910. % In all cases, if we have a float type, it comes first.
  8911. \ifx\floattype\empty \else \def\floatident{\floattype}\fi
  8912. %
  8913. % If we have an xref label, the number comes next.
  8914. \ifx\floatlabel\empty \else
  8915. \ifx\floattype\empty \else % if also had float type, need tie first.
  8916. \appendtomacro\floatident{\tie}%
  8917. \fi
  8918. % the number.
  8919. \appendtomacro\floatident{\chaplevelprefix\the\floatno}%
  8920. \fi
  8921. %
  8922. % Start the printed caption with what we've constructed in
  8923. % \floatident, but keep it separate; we need \floatident again.
  8924. \let\captionline = \floatident
  8925. %
  8926. \ifx\thiscaption\empty \else
  8927. \ifx\floatident\empty \else
  8928. \appendtomacro\captionline{: }% had ident, so need a colon between
  8929. \fi
  8930. %
  8931. % caption text.
  8932. \appendtomacro\captionline{\scanexp\thiscaption}%
  8933. \fi
  8934. %
  8935. % If we have anything to print, print it, with space before.
  8936. % Eventually this needs to become an \insert.
  8937. \ifx\captionline\empty \else
  8938. \vskip.5\parskip
  8939. \captionline
  8940. %
  8941. % Space below caption.
  8942. \vskip\parskip
  8943. \fi
  8944. %
  8945. % If have an xref label, write the list of floats info. Do this
  8946. % after the caption, to avoid chance of it being a breakpoint.
  8947. \ifx\floatlabel\empty \else
  8948. % Write the text that goes in the lof to the aux file as
  8949. % \floatlabel-lof. Besides \floatident, we include the short
  8950. % caption if specified, else the full caption if specified, else nothing.
  8951. {%
  8952. \requireauxfile
  8953. \atdummies
  8954. %
  8955. \ifx\thisshortcaption\empty
  8956. \def\gtemp{\thiscaption}%
  8957. \else
  8958. \def\gtemp{\thisshortcaption}%
  8959. \fi
  8960. \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident
  8961. \ifx\gtemp\empty \else : \gtemp \fi}}%
  8962. }%
  8963. \fi
  8964. \egroup % end of \vtop
  8965. %
  8966. \checkinserts
  8967. }
  8968. % Append the tokens #2 to the definition of macro #1, not expanding either.
  8969. %
  8970. \def\appendtomacro#1#2{%
  8971. \expandafter\def\expandafter#1\expandafter{#1#2}%
  8972. }
  8973. % @caption, @shortcaption
  8974. %
  8975. \def\caption{\docaption\thiscaption}
  8976. \def\shortcaption{\docaption\thisshortcaption}
  8977. \def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption}
  8978. \def\defcaption#1#2{\egroup \def#1{#2}}
  8979. % The parameter is the control sequence identifying the counter we are
  8980. % going to use. Create it if it doesn't exist and assign it to \floatno.
  8981. \def\getfloatno#1{%
  8982. \ifx#1\relax
  8983. % Haven't seen this figure type before.
  8984. \csname newcount\endcsname #1%
  8985. %
  8986. % Remember to reset this floatno at the next chap.
  8987. \expandafter\gdef\expandafter\resetallfloatnos
  8988. \expandafter{\resetallfloatnos #1=0 }%
  8989. \fi
  8990. \let\floatno#1%
  8991. }
  8992. % \setref calls this to get the XREFLABEL-snt value. We want an @xref
  8993. % to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we
  8994. % first read the @float command.
  8995. %
  8996. \def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}%
  8997. % Magic string used for the XREFLABEL-title value, so \xrefX can
  8998. % distinguish floats from other xref types.
  8999. \def\floatmagic{!!float!!}
  9000. % #1 is the control sequence we are passed; we expand into a conditional
  9001. % which is true if #1 represents a float ref. That is, the magic
  9002. % \lastsection value which we \setref above.
  9003. %
  9004. \def\iffloat#1{\expandafter\doiffloat#1==\finish}
  9005. %
  9006. % #1 is (maybe) the \floatmagic string. If so, #2 will be the
  9007. % (safe) float type for this float. We set \iffloattype to #2.
  9008. %
  9009. \def\doiffloat#1=#2=#3\finish{%
  9010. \def\temp{#1}%
  9011. \def\iffloattype{#2}%
  9012. \ifx\temp\floatmagic
  9013. }
  9014. % @listoffloats FLOATTYPE - print a list of floats like a table of contents.
  9015. %
  9016. \parseargdef\listoffloats{%
  9017. \def\floattype{#1}% floattype
  9018. {%
  9019. % the floattype might have accents or other special characters,
  9020. % but we need to use it in a control sequence name.
  9021. \indexnofonts
  9022. \turnoffactive
  9023. \xdef\safefloattype{\floattype}%
  9024. }%
  9025. %
  9026. % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE.
  9027. \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax
  9028. \ifhavexrefs
  9029. % if the user said @listoffloats foo but never @float foo.
  9030. \message{\linenumber No `\safefloattype' floats to list.}%
  9031. \fi
  9032. \else
  9033. \begingroup
  9034. \leftskip=\tocindent % indent these entries like a toc
  9035. \let\do=\listoffloatsdo
  9036. \csname floatlist\safefloattype\endcsname
  9037. \endgroup
  9038. \fi
  9039. }
  9040. % This is called on each entry in a list of floats. We're passed the
  9041. % xref label, in the form LABEL-title, which is how we save it in the
  9042. % aux file. We strip off the -title and look up \XRLABEL-lof, which
  9043. % has the text we're supposed to typeset here.
  9044. %
  9045. % Figures without xref labels will not be included in the list (since
  9046. % they won't appear in the aux file).
  9047. %
  9048. \def\listoffloatsdo#1{\listoffloatsdoentry#1\finish}
  9049. \def\listoffloatsdoentry#1-title\finish{{%
  9050. % Can't fully expand XR#1-lof because it can contain anything. Just
  9051. % pass the control sequence. On the other hand, XR#1-pg is just the
  9052. % page number, and we want to fully expand that so we can get a link
  9053. % in pdf output.
  9054. \toksA = \expandafter{\csname XR#1-lof\endcsname}%
  9055. %
  9056. % use the same \entry macro we use to generate the TOC and index.
  9057. \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
  9058. \writeentry
  9059. }}
  9060. \message{localization,}
  9061. % For single-language documents, @documentlanguage is usually given very
  9062. % early, just after @documentencoding. Single argument is the language
  9063. % (de) or locale (de_DE) abbreviation.
  9064. %
  9065. {
  9066. \catcode`\_ = \active
  9067. \globaldefs=1
  9068. \parseargdef\documentlanguage{%
  9069. \tex % read txi-??.tex file in plain TeX.
  9070. % Read the file by the name they passed if it exists.
  9071. \let_ = \normalunderscore % normal _ character for filename test
  9072. \openin 1 txi-#1.tex
  9073. \ifeof 1
  9074. \documentlanguagetrywithoutunderscore #1_\finish
  9075. \else
  9076. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9077. \input txi-#1.tex
  9078. \fi
  9079. \closein 1
  9080. \endgroup % end raw TeX
  9081. }
  9082. %
  9083. % If they passed de_DE, and txi-de_DE.tex doesn't exist,
  9084. % try txi-de.tex.
  9085. %
  9086. \gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
  9087. \openin 1 txi-#1.tex
  9088. \ifeof 1
  9089. \errhelp = \nolanghelp
  9090. \errmessage{Cannot read language file txi-#1.tex}%
  9091. \else
  9092. \globaldefs = 1 % everything in the txi-LL files needs to persist
  9093. \input txi-#1.tex
  9094. \fi
  9095. \closein 1
  9096. }
  9097. }% end of special _ catcode
  9098. %
  9099. \newhelp\nolanghelp{The given language definition file cannot be found or
  9100. is empty. Maybe you need to install it? Putting it in the current
  9101. directory should work if nowhere else does.}
  9102. % This macro is called from txi-??.tex files; the first argument is the
  9103. % \language name to set (without the "\lang@" prefix), the second and
  9104. % third args are \{left,right}hyphenmin.
  9105. %
  9106. % The language names to pass are determined when the format is built.
  9107. % See the etex.log file created at that time, e.g.,
  9108. % /usr/local/texlive/2008/texmf-var/web2c/pdftex/etex.log.
  9109. %
  9110. % With TeX Live 2008, etex now includes hyphenation patterns for all
  9111. % available languages. This means we can support hyphenation in
  9112. % Texinfo, at least to some extent. (This still doesn't solve the
  9113. % accented characters problem.)
  9114. %
  9115. \catcode`@=11
  9116. \def\txisetlanguage#1#2#3{%
  9117. % do not set the language if the name is undefined in the current TeX.
  9118. \expandafter\ifx\csname lang@#1\endcsname \relax
  9119. \message{no patterns for #1}%
  9120. \else
  9121. \global\language = \csname lang@#1\endcsname
  9122. \fi
  9123. % but there is no harm in adjusting the hyphenmin values regardless.
  9124. \global\lefthyphenmin = #2\relax
  9125. \global\righthyphenmin = #3\relax
  9126. }
  9127. % XeTeX and LuaTeX can handle Unicode natively.
  9128. % Their default I/O uses UTF-8 sequences instead of a byte-wise operation.
  9129. % Other TeX engines' I/O (pdfTeX, etc.) is byte-wise.
  9130. %
  9131. \newif\iftxinativeunicodecapable
  9132. \newif\iftxiusebytewiseio
  9133. \ifx\XeTeXrevision\thisisundefined
  9134. \ifx\luatexversion\thisisundefined
  9135. \txinativeunicodecapablefalse
  9136. \txiusebytewiseiotrue
  9137. \else
  9138. \txinativeunicodecapabletrue
  9139. \txiusebytewiseiofalse
  9140. \fi
  9141. \else
  9142. \txinativeunicodecapabletrue
  9143. \txiusebytewiseiofalse
  9144. \fi
  9145. % Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
  9146. % for non-UTF-8 (byte-wise) encodings.
  9147. %
  9148. \def\setbytewiseio{%
  9149. \ifx\XeTeXrevision\thisisundefined
  9150. \else
  9151. \XeTeXdefaultencoding "bytes" % For subsequent files to be read
  9152. \XeTeXinputencoding "bytes" % For document root file
  9153. % Unfortunately, there seems to be no corresponding XeTeX command for
  9154. % output encoding. This is a problem for auxiliary index and TOC files.
  9155. % The only solution would be perhaps to write out @U{...} sequences in
  9156. % place of non-ASCII characters.
  9157. \fi
  9158. \ifx\luatexversion\thisisundefined
  9159. \else
  9160. \directlua{
  9161. local utf8_char, byte, gsub = unicode.utf8.char, string.byte, string.gsub
  9162. local function convert_char (char)
  9163. return utf8_char(byte(char))
  9164. end
  9165. local function convert_line (line)
  9166. return gsub(line, ".", convert_char)
  9167. end
  9168. callback.register("process_input_buffer", convert_line)
  9169. local function convert_line_out (line)
  9170. local line_out = ""
  9171. for c in string.utfvalues(line) do
  9172. line_out = line_out .. string.char(c)
  9173. end
  9174. return line_out
  9175. end
  9176. callback.register("process_output_buffer", convert_line_out)
  9177. }
  9178. \fi
  9179. \txiusebytewiseiotrue
  9180. }
  9181. % Helpers for encodings.
  9182. % Set the catcode of characters 128 through 255 to the specified number.
  9183. %
  9184. \def\setnonasciicharscatcode#1{%
  9185. \count255=128
  9186. \loop\ifnum\count255<256
  9187. \global\catcode\count255=#1\relax
  9188. \advance\count255 by 1
  9189. \repeat
  9190. }
  9191. \def\setnonasciicharscatcodenonglobal#1{%
  9192. \count255=128
  9193. \loop\ifnum\count255<256
  9194. \catcode\count255=#1\relax
  9195. \advance\count255 by 1
  9196. \repeat
  9197. }
  9198. % @documentencoding sets the definition of non-ASCII characters
  9199. % according to the specified encoding.
  9200. %
  9201. \def\documentencoding{\parseargusing\filenamecatcodes\documentencodingzzz}
  9202. \def\documentencodingzzz#1{%
  9203. %
  9204. % Encoding being declared for the document.
  9205. \def\declaredencoding{\csname #1.enc\endcsname}%
  9206. %
  9207. % Supported encodings: names converted to tokens in order to be able
  9208. % to compare them with \ifx.
  9209. \def\ascii{\csname US-ASCII.enc\endcsname}%
  9210. \def\latnine{\csname ISO-8859-15.enc\endcsname}%
  9211. \def\latone{\csname ISO-8859-1.enc\endcsname}%
  9212. \def\lattwo{\csname ISO-8859-2.enc\endcsname}%
  9213. \def\utfeight{\csname UTF-8.enc\endcsname}%
  9214. %
  9215. \ifx \declaredencoding \ascii
  9216. \asciichardefs
  9217. %
  9218. \else \ifx \declaredencoding \lattwo
  9219. \iftxinativeunicodecapable
  9220. \setbytewiseio
  9221. \fi
  9222. \setnonasciicharscatcode\active
  9223. \lattwochardefs
  9224. %
  9225. \else \ifx \declaredencoding \latone
  9226. \iftxinativeunicodecapable
  9227. \setbytewiseio
  9228. \fi
  9229. \setnonasciicharscatcode\active
  9230. \latonechardefs
  9231. %
  9232. \else \ifx \declaredencoding \latnine
  9233. \iftxinativeunicodecapable
  9234. \setbytewiseio
  9235. \fi
  9236. \setnonasciicharscatcode\active
  9237. \latninechardefs
  9238. %
  9239. \else \ifx \declaredencoding \utfeight
  9240. \iftxinativeunicodecapable
  9241. % For native Unicode handling (XeTeX and LuaTeX)
  9242. \nativeunicodechardefs
  9243. \else
  9244. % For treating UTF-8 as byte sequences (TeX, eTeX and pdfTeX)
  9245. \setnonasciicharscatcode\active
  9246. % since we already invoked \utfeightchardefs at the top level
  9247. % (below), do not re-invoke it, otherwise our check for duplicated
  9248. % definitions gets triggered. Making non-ascii chars active is
  9249. % sufficient.
  9250. \fi
  9251. %
  9252. \else
  9253. \message{Ignoring unknown document encoding: #1.}%
  9254. %
  9255. \fi % utfeight
  9256. \fi % latnine
  9257. \fi % latone
  9258. \fi % lattwo
  9259. \fi % ascii
  9260. %
  9261. \ifx\XeTeXrevision\thisisundefined
  9262. \else
  9263. \ifx \declaredencoding \utfeight
  9264. \else
  9265. \ifx \declaredencoding \ascii
  9266. \else
  9267. \message{Warning: XeTeX with non-UTF-8 encodings cannot handle %
  9268. non-ASCII characters in auxiliary files.}%
  9269. \fi
  9270. \fi
  9271. \fi
  9272. }
  9273. % emacs-page
  9274. % A message to be logged when using a character that isn't available
  9275. % the default font encoding (OT1).
  9276. %
  9277. \def\missingcharmsg#1{\message{Character missing, sorry: #1.}}
  9278. % Take account of \c (plain) vs. \, (Texinfo) difference.
  9279. \def\cedilla#1{\ifx\c\ptexc\c{#1}\else\,{#1}\fi}
  9280. % First, make active non-ASCII characters in order for them to be
  9281. % correctly categorized when TeX reads the replacement text of
  9282. % macros containing the character definitions.
  9283. \setnonasciicharscatcode\active
  9284. %
  9285. \def\gdefchar#1#2{%
  9286. \gdef#1{%
  9287. \ifpassthroughchars
  9288. \string#1%
  9289. \else
  9290. #2%
  9291. \fi
  9292. }}
  9293. % Latin1 (ISO-8859-1) character definitions.
  9294. \def\latonechardefs{%
  9295. \gdefchar^^a0{\tie}
  9296. \gdefchar^^a1{\exclamdown}
  9297. \gdefchar^^a2{{\tcfont \char162}} % cent
  9298. \gdefchar^^a3{\pounds{}}
  9299. \gdefchar^^a4{{\tcfont \char164}} % currency
  9300. \gdefchar^^a5{{\tcfont \char165}} % yen
  9301. \gdefchar^^a6{{\tcfont \char166}} % broken bar
  9302. \gdefchar^^a7{\S}
  9303. \gdefchar^^a8{\"{}}
  9304. \gdefchar^^a9{\copyright{}}
  9305. \gdefchar^^aa{\ordf}
  9306. \gdefchar^^ab{\guillemetleft{}}
  9307. \gdefchar^^ac{\ensuremath\lnot}
  9308. \gdefchar^^ad{\-}
  9309. \gdefchar^^ae{\registeredsymbol{}}
  9310. \gdefchar^^af{\={}}
  9311. %
  9312. \gdefchar^^b0{\textdegree}
  9313. \gdefchar^^b1{$\pm$}
  9314. \gdefchar^^b2{$^2$}
  9315. \gdefchar^^b3{$^3$}
  9316. \gdefchar^^b4{\'{}}
  9317. \gdefchar^^b5{$\mu$}
  9318. \gdefchar^^b6{\P}
  9319. \gdefchar^^b7{\ensuremath\cdot}
  9320. \gdefchar^^b8{\cedilla\ }
  9321. \gdefchar^^b9{$^1$}
  9322. \gdefchar^^ba{\ordm}
  9323. \gdefchar^^bb{\guillemetright{}}
  9324. \gdefchar^^bc{$1\over4$}
  9325. \gdefchar^^bd{$1\over2$}
  9326. \gdefchar^^be{$3\over4$}
  9327. \gdefchar^^bf{\questiondown}
  9328. %
  9329. \gdefchar^^c0{\`A}
  9330. \gdefchar^^c1{\'A}
  9331. \gdefchar^^c2{\^A}
  9332. \gdefchar^^c3{\~A}
  9333. \gdefchar^^c4{\"A}
  9334. \gdefchar^^c5{\ringaccent A}
  9335. \gdefchar^^c6{\AE}
  9336. \gdefchar^^c7{\cedilla C}
  9337. \gdefchar^^c8{\`E}
  9338. \gdefchar^^c9{\'E}
  9339. \gdefchar^^ca{\^E}
  9340. \gdefchar^^cb{\"E}
  9341. \gdefchar^^cc{\`I}
  9342. \gdefchar^^cd{\'I}
  9343. \gdefchar^^ce{\^I}
  9344. \gdefchar^^cf{\"I}
  9345. %
  9346. \gdefchar^^d0{\DH}
  9347. \gdefchar^^d1{\~N}
  9348. \gdefchar^^d2{\`O}
  9349. \gdefchar^^d3{\'O}
  9350. \gdefchar^^d4{\^O}
  9351. \gdefchar^^d5{\~O}
  9352. \gdefchar^^d6{\"O}
  9353. \gdefchar^^d7{$\times$}
  9354. \gdefchar^^d8{\O}
  9355. \gdefchar^^d9{\`U}
  9356. \gdefchar^^da{\'U}
  9357. \gdefchar^^db{\^U}
  9358. \gdefchar^^dc{\"U}
  9359. \gdefchar^^dd{\'Y}
  9360. \gdefchar^^de{\TH}
  9361. \gdefchar^^df{\ss}
  9362. %
  9363. \gdefchar^^e0{\`a}
  9364. \gdefchar^^e1{\'a}
  9365. \gdefchar^^e2{\^a}
  9366. \gdefchar^^e3{\~a}
  9367. \gdefchar^^e4{\"a}
  9368. \gdefchar^^e5{\ringaccent a}
  9369. \gdefchar^^e6{\ae}
  9370. \gdefchar^^e7{\cedilla c}
  9371. \gdefchar^^e8{\`e}
  9372. \gdefchar^^e9{\'e}
  9373. \gdefchar^^ea{\^e}
  9374. \gdefchar^^eb{\"e}
  9375. \gdefchar^^ec{\`{\dotless i}}
  9376. \gdefchar^^ed{\'{\dotless i}}
  9377. \gdefchar^^ee{\^{\dotless i}}
  9378. \gdefchar^^ef{\"{\dotless i}}
  9379. %
  9380. \gdefchar^^f0{\dh}
  9381. \gdefchar^^f1{\~n}
  9382. \gdefchar^^f2{\`o}
  9383. \gdefchar^^f3{\'o}
  9384. \gdefchar^^f4{\^o}
  9385. \gdefchar^^f5{\~o}
  9386. \gdefchar^^f6{\"o}
  9387. \gdefchar^^f7{$\div$}
  9388. \gdefchar^^f8{\o}
  9389. \gdefchar^^f9{\`u}
  9390. \gdefchar^^fa{\'u}
  9391. \gdefchar^^fb{\^u}
  9392. \gdefchar^^fc{\"u}
  9393. \gdefchar^^fd{\'y}
  9394. \gdefchar^^fe{\th}
  9395. \gdefchar^^ff{\"y}
  9396. }
  9397. % Latin9 (ISO-8859-15) encoding character definitions.
  9398. \def\latninechardefs{%
  9399. % Encoding is almost identical to Latin1.
  9400. \latonechardefs
  9401. %
  9402. \gdefchar^^a4{\euro{}}
  9403. \gdefchar^^a6{\v S}
  9404. \gdefchar^^a8{\v s}
  9405. \gdefchar^^b4{\v Z}
  9406. \gdefchar^^b8{\v z}
  9407. \gdefchar^^bc{\OE}
  9408. \gdefchar^^bd{\oe}
  9409. \gdefchar^^be{\"Y}
  9410. }
  9411. % Latin2 (ISO-8859-2) character definitions.
  9412. \def\lattwochardefs{%
  9413. \gdefchar^^a0{\tie}
  9414. \gdefchar^^a1{\ogonek{A}}
  9415. \gdefchar^^a2{\u{}}
  9416. \gdefchar^^a3{\L}
  9417. \gdefchar^^a4{\missingcharmsg{CURRENCY SIGN}}
  9418. \gdefchar^^a5{\v L}
  9419. \gdefchar^^a6{\'S}
  9420. \gdefchar^^a7{\S}
  9421. \gdefchar^^a8{\"{}}
  9422. \gdefchar^^a9{\v S}
  9423. \gdefchar^^aa{\cedilla S}
  9424. \gdefchar^^ab{\v T}
  9425. \gdefchar^^ac{\'Z}
  9426. \gdefchar^^ad{\-}
  9427. \gdefchar^^ae{\v Z}
  9428. \gdefchar^^af{\dotaccent Z}
  9429. %
  9430. \gdefchar^^b0{\textdegree{}}
  9431. \gdefchar^^b1{\ogonek{a}}
  9432. \gdefchar^^b2{\ogonek{ }}
  9433. \gdefchar^^b3{\l}
  9434. \gdefchar^^b4{\'{}}
  9435. \gdefchar^^b5{\v l}
  9436. \gdefchar^^b6{\'s}
  9437. \gdefchar^^b7{\v{}}
  9438. \gdefchar^^b8{\cedilla\ }
  9439. \gdefchar^^b9{\v s}
  9440. \gdefchar^^ba{\cedilla s}
  9441. \gdefchar^^bb{\v t}
  9442. \gdefchar^^bc{\'z}
  9443. \gdefchar^^bd{\H{}}
  9444. \gdefchar^^be{\v z}
  9445. \gdefchar^^bf{\dotaccent z}
  9446. %
  9447. \gdefchar^^c0{\'R}
  9448. \gdefchar^^c1{\'A}
  9449. \gdefchar^^c2{\^A}
  9450. \gdefchar^^c3{\u A}
  9451. \gdefchar^^c4{\"A}
  9452. \gdefchar^^c5{\'L}
  9453. \gdefchar^^c6{\'C}
  9454. \gdefchar^^c7{\cedilla C}
  9455. \gdefchar^^c8{\v C}
  9456. \gdefchar^^c9{\'E}
  9457. \gdefchar^^ca{\ogonek{E}}
  9458. \gdefchar^^cb{\"E}
  9459. \gdefchar^^cc{\v E}
  9460. \gdefchar^^cd{\'I}
  9461. \gdefchar^^ce{\^I}
  9462. \gdefchar^^cf{\v D}
  9463. %
  9464. \gdefchar^^d0{\DH}
  9465. \gdefchar^^d1{\'N}
  9466. \gdefchar^^d2{\v N}
  9467. \gdefchar^^d3{\'O}
  9468. \gdefchar^^d4{\^O}
  9469. \gdefchar^^d5{\H O}
  9470. \gdefchar^^d6{\"O}
  9471. \gdefchar^^d7{$\times$}
  9472. \gdefchar^^d8{\v R}
  9473. \gdefchar^^d9{\ringaccent U}
  9474. \gdefchar^^da{\'U}
  9475. \gdefchar^^db{\H U}
  9476. \gdefchar^^dc{\"U}
  9477. \gdefchar^^dd{\'Y}
  9478. \gdefchar^^de{\cedilla T}
  9479. \gdefchar^^df{\ss}
  9480. %
  9481. \gdefchar^^e0{\'r}
  9482. \gdefchar^^e1{\'a}
  9483. \gdefchar^^e2{\^a}
  9484. \gdefchar^^e3{\u a}
  9485. \gdefchar^^e4{\"a}
  9486. \gdefchar^^e5{\'l}
  9487. \gdefchar^^e6{\'c}
  9488. \gdefchar^^e7{\cedilla c}
  9489. \gdefchar^^e8{\v c}
  9490. \gdefchar^^e9{\'e}
  9491. \gdefchar^^ea{\ogonek{e}}
  9492. \gdefchar^^eb{\"e}
  9493. \gdefchar^^ec{\v e}
  9494. \gdefchar^^ed{\'{\dotless{i}}}
  9495. \gdefchar^^ee{\^{\dotless{i}}}
  9496. \gdefchar^^ef{\v d}
  9497. %
  9498. \gdefchar^^f0{\dh}
  9499. \gdefchar^^f1{\'n}
  9500. \gdefchar^^f2{\v n}
  9501. \gdefchar^^f3{\'o}
  9502. \gdefchar^^f4{\^o}
  9503. \gdefchar^^f5{\H o}
  9504. \gdefchar^^f6{\"o}
  9505. \gdefchar^^f7{$\div$}
  9506. \gdefchar^^f8{\v r}
  9507. \gdefchar^^f9{\ringaccent u}
  9508. \gdefchar^^fa{\'u}
  9509. \gdefchar^^fb{\H u}
  9510. \gdefchar^^fc{\"u}
  9511. \gdefchar^^fd{\'y}
  9512. \gdefchar^^fe{\cedilla t}
  9513. \gdefchar^^ff{\dotaccent{}}
  9514. }
  9515. % UTF-8 character definitions.
  9516. %
  9517. % This code to support UTF-8 is based on LaTeX's utf8.def, with some
  9518. % changes for Texinfo conventions. It is included here under the GPL by
  9519. % permission from Frank Mittelbach and the LaTeX team.
  9520. %
  9521. \newcount\countUTFx
  9522. \newcount\countUTFy
  9523. \newcount\countUTFz
  9524. \gdef\UTFviiiTwoOctets#1#2{\expandafter
  9525. \UTFviiiDefined\csname u8:#1\string #2\endcsname}
  9526. %
  9527. \gdef\UTFviiiThreeOctets#1#2#3{\expandafter
  9528. \UTFviiiDefined\csname u8:#1\string #2\string #3\endcsname}
  9529. %
  9530. \gdef\UTFviiiFourOctets#1#2#3#4{\expandafter
  9531. \UTFviiiDefined\csname u8:#1\string #2\string #3\string #4\endcsname}
  9532. \gdef\UTFviiiDefined#1{%
  9533. \ifx #1\relax
  9534. \message{\linenumber Unicode char \string #1 not defined for Texinfo}%
  9535. \else
  9536. \expandafter #1%
  9537. \fi
  9538. }
  9539. % Give non-ASCII bytes the active definitions for processing UTF-8 sequences
  9540. \begingroup
  9541. \catcode`\~13
  9542. \catcode`\$12
  9543. \catcode`\"12
  9544. % Loop from \countUTFx to \countUTFy, performing \UTFviiiTmp
  9545. % substituting ~ and $ with a character token of that value.
  9546. \def\UTFviiiLoop{%
  9547. \global\catcode\countUTFx\active
  9548. \uccode`\~\countUTFx
  9549. \uccode`\$\countUTFx
  9550. \uppercase\expandafter{\UTFviiiTmp}%
  9551. \advance\countUTFx by 1
  9552. \ifnum\countUTFx < \countUTFy
  9553. \expandafter\UTFviiiLoop
  9554. \fi}
  9555. % For bytes other than the first in a UTF-8 sequence. Not expected to
  9556. % be expanded except when writing to auxiliary files.
  9557. \countUTFx = "80
  9558. \countUTFy = "C2
  9559. \def\UTFviiiTmp{%
  9560. \gdef~{%
  9561. \ifpassthroughchars $\fi}}%
  9562. \UTFviiiLoop
  9563. \countUTFx = "C2
  9564. \countUTFy = "E0
  9565. \def\UTFviiiTmp{%
  9566. \gdef~{%
  9567. \ifpassthroughchars $%
  9568. \else\expandafter\UTFviiiTwoOctets\expandafter$\fi}}%
  9569. \UTFviiiLoop
  9570. \countUTFx = "E0
  9571. \countUTFy = "F0
  9572. \def\UTFviiiTmp{%
  9573. \gdef~{%
  9574. \ifpassthroughchars $%
  9575. \else\expandafter\UTFviiiThreeOctets\expandafter$\fi}}%
  9576. \UTFviiiLoop
  9577. \countUTFx = "F0
  9578. \countUTFy = "F4
  9579. \def\UTFviiiTmp{%
  9580. \gdef~{%
  9581. \ifpassthroughchars $%
  9582. \else\expandafter\UTFviiiFourOctets\expandafter$\fi
  9583. }}%
  9584. \UTFviiiLoop
  9585. \endgroup
  9586. \def\globallet{\global\let} % save some \expandafter's below
  9587. % @U{xxxx} to produce U+xxxx, if we support it.
  9588. \def\U#1{%
  9589. \expandafter\ifx\csname uni:#1\endcsname \relax
  9590. \iftxinativeunicodecapable
  9591. % All Unicode characters can be used if native Unicode handling is
  9592. % active. However, if the font does not have the glyph,
  9593. % letters are missing.
  9594. \begingroup
  9595. \uccode`\.="#1\relax
  9596. \uppercase{.}
  9597. \endgroup
  9598. \else
  9599. \errhelp = \EMsimple
  9600. \errmessage{Unicode character U+#1 not supported, sorry}%
  9601. \fi
  9602. \else
  9603. \csname uni:#1\endcsname
  9604. \fi
  9605. }
  9606. % These macros are used here to construct the name of a control
  9607. % sequence to be defined.
  9608. \def\UTFviiiTwoOctetsName#1#2{%
  9609. \csname u8:#1\string #2\endcsname}%
  9610. \def\UTFviiiThreeOctetsName#1#2#3{%
  9611. \csname u8:#1\string #2\string #3\endcsname}%
  9612. \def\UTFviiiFourOctetsName#1#2#3#4{%
  9613. \csname u8:#1\string #2\string #3\string #4\endcsname}%
  9614. % For UTF-8 byte sequences (TeX, e-TeX and pdfTeX),
  9615. % provide a definition macro to replace a Unicode character;
  9616. % this gets used by the @U command
  9617. %
  9618. \begingroup
  9619. \catcode`\"=12
  9620. \catcode`\<=12
  9621. \catcode`\.=12
  9622. \catcode`\,=12
  9623. \catcode`\;=12
  9624. \catcode`\!=12
  9625. \catcode`\~=13
  9626. \gdef\DeclareUnicodeCharacterUTFviii#1#2{%
  9627. \countUTFz = "#1\relax
  9628. \begingroup
  9629. \parseXMLCharref
  9630. % Give \u8:... its definition. The sequence of seven \expandafter's
  9631. % expands after the \gdef three times, e.g.
  9632. %
  9633. % 1. \UTFviiTwoOctetsName B1 B2
  9634. % 2. \csname u8:B1 \string B2 \endcsname
  9635. % 3. \u8: B1 B2 (a single control sequence token)
  9636. %
  9637. \expandafter\expandafter
  9638. \expandafter\expandafter
  9639. \expandafter\expandafter
  9640. \expandafter\gdef \UTFviiiTmp{#2}%
  9641. %
  9642. \expandafter\ifx\csname uni:#1\endcsname \relax \else
  9643. \message{Internal error, already defined: #1}%
  9644. \fi
  9645. %
  9646. % define an additional control sequence for this code point.
  9647. \expandafter\globallet\csname uni:#1\endcsname \UTFviiiTmp
  9648. \endgroup}
  9649. %
  9650. % Given the value in \countUTFz as a Unicode code point, set \UTFviiiTmp
  9651. % to the corresponding UTF-8 sequence.
  9652. \gdef\parseXMLCharref{%
  9653. \ifnum\countUTFz < "A0\relax
  9654. \errhelp = \EMsimple
  9655. \errmessage{Cannot define Unicode char value < 00A0}%
  9656. \else\ifnum\countUTFz < "800\relax
  9657. \parseUTFviiiA,%
  9658. \parseUTFviiiB C\UTFviiiTwoOctetsName.,%
  9659. \else\ifnum\countUTFz < "10000\relax
  9660. \parseUTFviiiA;%
  9661. \parseUTFviiiA,%
  9662. \parseUTFviiiB E\UTFviiiThreeOctetsName.{,;}%
  9663. \else
  9664. \parseUTFviiiA;%
  9665. \parseUTFviiiA,%
  9666. \parseUTFviiiA!%
  9667. \parseUTFviiiB F\UTFviiiFourOctetsName.{!,;}%
  9668. \fi\fi\fi
  9669. }
  9670. % Extract a byte from the end of the UTF-8 representation of \countUTFx.
  9671. % It must be a non-initial byte in the sequence.
  9672. % Change \uccode of #1 for it to be used in \parseUTFviiiB as one
  9673. % of the bytes.
  9674. \gdef\parseUTFviiiA#1{%
  9675. \countUTFx = \countUTFz
  9676. \divide\countUTFz by 64
  9677. \countUTFy = \countUTFz % Save to be the future value of \countUTFz.
  9678. \multiply\countUTFz by 64
  9679. % \countUTFz is now \countUTFx with the last 5 bits cleared. Subtract
  9680. % in order to get the last five bits.
  9681. \advance\countUTFx by -\countUTFz
  9682. % Convert this to the byte in the UTF-8 sequence.
  9683. \advance\countUTFx by 128
  9684. \uccode `#1\countUTFx
  9685. \countUTFz = \countUTFy}
  9686. % Used to put a UTF-8 byte sequence into \UTFviiiTmp
  9687. % #1 is the increment for \countUTFz to yield a the first byte of the UTF-8
  9688. % sequence.
  9689. % #2 is one of the \UTFviii*OctetsName macros.
  9690. % #3 is always a full stop (.)
  9691. % #4 is a template for the other bytes in the sequence. The values for these
  9692. % bytes is substituted in here with \uppercase using the \uccode's.
  9693. \gdef\parseUTFviiiB#1#2#3#4{%
  9694. \advance\countUTFz by "#10\relax
  9695. \uccode `#3\countUTFz
  9696. \uppercase{\gdef\UTFviiiTmp{#2#3#4}}}
  9697. \endgroup
  9698. % For native Unicode handling (XeTeX and LuaTeX),
  9699. % provide a definition macro that sets a catcode to `other' non-globally
  9700. %
  9701. \def\DeclareUnicodeCharacterNativeOther#1#2{%
  9702. \catcode"#1=\other
  9703. }
  9704. % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
  9705. % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
  9706. % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)
  9707. % U+0100..U+017F = https://en.wikipedia.org/wiki/Latin_Extended-A
  9708. % U+0180..U+024F = https://en.wikipedia.org/wiki/Latin_Extended-B
  9709. %
  9710. % Many of our renditions are less than wonderful, and all the missing
  9711. % characters are available somewhere. Loading the necessary fonts
  9712. % awaits user request. We can't truly support Unicode without
  9713. % reimplementing everything that's been done in LaTeX for many years,
  9714. % plus probably using luatex or xetex, and who knows what else.
  9715. % We won't be doing that here in this simple file. But we can try to at
  9716. % least make most of the characters not bomb out.
  9717. %
  9718. \def\unicodechardefs{%
  9719. \DeclareUnicodeCharacter{00A0}{\tie}%
  9720. \DeclareUnicodeCharacter{00A1}{\exclamdown}%
  9721. \DeclareUnicodeCharacter{00A2}{{\tcfont \char162}}% 0242=cent
  9722. \DeclareUnicodeCharacter{00A3}{\pounds{}}%
  9723. \DeclareUnicodeCharacter{00A4}{{\tcfont \char164}}% 0244=currency
  9724. \DeclareUnicodeCharacter{00A5}{{\tcfont \char165}}% 0245=yen
  9725. \DeclareUnicodeCharacter{00A6}{{\tcfont \char166}}% 0246=brokenbar
  9726. \DeclareUnicodeCharacter{00A7}{\S}%
  9727. \DeclareUnicodeCharacter{00A8}{\"{ }}%
  9728. \DeclareUnicodeCharacter{00A9}{\copyright{}}%
  9729. \DeclareUnicodeCharacter{00AA}{\ordf}%
  9730. \DeclareUnicodeCharacter{00AB}{\guillemetleft{}}%
  9731. \DeclareUnicodeCharacter{00AC}{\ensuremath\lnot}%
  9732. \DeclareUnicodeCharacter{00AD}{\-}%
  9733. \DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
  9734. \DeclareUnicodeCharacter{00AF}{\={ }}%
  9735. %
  9736. \DeclareUnicodeCharacter{00B0}{\ringaccent{ }}%
  9737. \DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
  9738. \DeclareUnicodeCharacter{00B2}{$^2$}%
  9739. \DeclareUnicodeCharacter{00B3}{$^3$}%
  9740. \DeclareUnicodeCharacter{00B4}{\'{ }}%
  9741. \DeclareUnicodeCharacter{00B5}{$\mu$}%
  9742. \DeclareUnicodeCharacter{00B6}{\P}%
  9743. \DeclareUnicodeCharacter{00B7}{\ensuremath\cdot}%
  9744. \DeclareUnicodeCharacter{00B8}{\cedilla{ }}%
  9745. \DeclareUnicodeCharacter{00B9}{$^1$}%
  9746. \DeclareUnicodeCharacter{00BA}{\ordm}%
  9747. \DeclareUnicodeCharacter{00BB}{\guillemetright{}}%
  9748. \DeclareUnicodeCharacter{00BC}{$1\over4$}%
  9749. \DeclareUnicodeCharacter{00BD}{$1\over2$}%
  9750. \DeclareUnicodeCharacter{00BE}{$3\over4$}%
  9751. \DeclareUnicodeCharacter{00BF}{\questiondown}%
  9752. %
  9753. \DeclareUnicodeCharacter{00C0}{\`A}%
  9754. \DeclareUnicodeCharacter{00C1}{\'A}%
  9755. \DeclareUnicodeCharacter{00C2}{\^A}%
  9756. \DeclareUnicodeCharacter{00C3}{\~A}%
  9757. \DeclareUnicodeCharacter{00C4}{\"A}%
  9758. \DeclareUnicodeCharacter{00C5}{\AA}%
  9759. \DeclareUnicodeCharacter{00C6}{\AE}%
  9760. \DeclareUnicodeCharacter{00C7}{\cedilla{C}}%
  9761. \DeclareUnicodeCharacter{00C8}{\`E}%
  9762. \DeclareUnicodeCharacter{00C9}{\'E}%
  9763. \DeclareUnicodeCharacter{00CA}{\^E}%
  9764. \DeclareUnicodeCharacter{00CB}{\"E}%
  9765. \DeclareUnicodeCharacter{00CC}{\`I}%
  9766. \DeclareUnicodeCharacter{00CD}{\'I}%
  9767. \DeclareUnicodeCharacter{00CE}{\^I}%
  9768. \DeclareUnicodeCharacter{00CF}{\"I}%
  9769. %
  9770. \DeclareUnicodeCharacter{00D0}{\DH}%
  9771. \DeclareUnicodeCharacter{00D1}{\~N}%
  9772. \DeclareUnicodeCharacter{00D2}{\`O}%
  9773. \DeclareUnicodeCharacter{00D3}{\'O}%
  9774. \DeclareUnicodeCharacter{00D4}{\^O}%
  9775. \DeclareUnicodeCharacter{00D5}{\~O}%
  9776. \DeclareUnicodeCharacter{00D6}{\"O}%
  9777. \DeclareUnicodeCharacter{00D7}{\ensuremath\times}%
  9778. \DeclareUnicodeCharacter{00D8}{\O}%
  9779. \DeclareUnicodeCharacter{00D9}{\`U}%
  9780. \DeclareUnicodeCharacter{00DA}{\'U}%
  9781. \DeclareUnicodeCharacter{00DB}{\^U}%
  9782. \DeclareUnicodeCharacter{00DC}{\"U}%
  9783. \DeclareUnicodeCharacter{00DD}{\'Y}%
  9784. \DeclareUnicodeCharacter{00DE}{\TH}%
  9785. \DeclareUnicodeCharacter{00DF}{\ss}%
  9786. %
  9787. \DeclareUnicodeCharacter{00E0}{\`a}%
  9788. \DeclareUnicodeCharacter{00E1}{\'a}%
  9789. \DeclareUnicodeCharacter{00E2}{\^a}%
  9790. \DeclareUnicodeCharacter{00E3}{\~a}%
  9791. \DeclareUnicodeCharacter{00E4}{\"a}%
  9792. \DeclareUnicodeCharacter{00E5}{\aa}%
  9793. \DeclareUnicodeCharacter{00E6}{\ae}%
  9794. \DeclareUnicodeCharacter{00E7}{\cedilla{c}}%
  9795. \DeclareUnicodeCharacter{00E8}{\`e}%
  9796. \DeclareUnicodeCharacter{00E9}{\'e}%
  9797. \DeclareUnicodeCharacter{00EA}{\^e}%
  9798. \DeclareUnicodeCharacter{00EB}{\"e}%
  9799. \DeclareUnicodeCharacter{00EC}{\`{\dotless{i}}}%
  9800. \DeclareUnicodeCharacter{00ED}{\'{\dotless{i}}}%
  9801. \DeclareUnicodeCharacter{00EE}{\^{\dotless{i}}}%
  9802. \DeclareUnicodeCharacter{00EF}{\"{\dotless{i}}}%
  9803. %
  9804. \DeclareUnicodeCharacter{00F0}{\dh}%
  9805. \DeclareUnicodeCharacter{00F1}{\~n}%
  9806. \DeclareUnicodeCharacter{00F2}{\`o}%
  9807. \DeclareUnicodeCharacter{00F3}{\'o}%
  9808. \DeclareUnicodeCharacter{00F4}{\^o}%
  9809. \DeclareUnicodeCharacter{00F5}{\~o}%
  9810. \DeclareUnicodeCharacter{00F6}{\"o}%
  9811. \DeclareUnicodeCharacter{00F7}{\ensuremath\div}%
  9812. \DeclareUnicodeCharacter{00F8}{\o}%
  9813. \DeclareUnicodeCharacter{00F9}{\`u}%
  9814. \DeclareUnicodeCharacter{00FA}{\'u}%
  9815. \DeclareUnicodeCharacter{00FB}{\^u}%
  9816. \DeclareUnicodeCharacter{00FC}{\"u}%
  9817. \DeclareUnicodeCharacter{00FD}{\'y}%
  9818. \DeclareUnicodeCharacter{00FE}{\th}%
  9819. \DeclareUnicodeCharacter{00FF}{\"y}%
  9820. %
  9821. \DeclareUnicodeCharacter{0100}{\=A}%
  9822. \DeclareUnicodeCharacter{0101}{\=a}%
  9823. \DeclareUnicodeCharacter{0102}{\u{A}}%
  9824. \DeclareUnicodeCharacter{0103}{\u{a}}%
  9825. \DeclareUnicodeCharacter{0104}{\ogonek{A}}%
  9826. \DeclareUnicodeCharacter{0105}{\ogonek{a}}%
  9827. \DeclareUnicodeCharacter{0106}{\'C}%
  9828. \DeclareUnicodeCharacter{0107}{\'c}%
  9829. \DeclareUnicodeCharacter{0108}{\^C}%
  9830. \DeclareUnicodeCharacter{0109}{\^c}%
  9831. \DeclareUnicodeCharacter{010A}{\dotaccent{C}}%
  9832. \DeclareUnicodeCharacter{010B}{\dotaccent{c}}%
  9833. \DeclareUnicodeCharacter{010C}{\v{C}}%
  9834. \DeclareUnicodeCharacter{010D}{\v{c}}%
  9835. \DeclareUnicodeCharacter{010E}{\v{D}}%
  9836. \DeclareUnicodeCharacter{010F}{d'}%
  9837. %
  9838. \DeclareUnicodeCharacter{0110}{\DH}%
  9839. \DeclareUnicodeCharacter{0111}{\dh}%
  9840. \DeclareUnicodeCharacter{0112}{\=E}%
  9841. \DeclareUnicodeCharacter{0113}{\=e}%
  9842. \DeclareUnicodeCharacter{0114}{\u{E}}%
  9843. \DeclareUnicodeCharacter{0115}{\u{e}}%
  9844. \DeclareUnicodeCharacter{0116}{\dotaccent{E}}%
  9845. \DeclareUnicodeCharacter{0117}{\dotaccent{e}}%
  9846. \DeclareUnicodeCharacter{0118}{\ogonek{E}}%
  9847. \DeclareUnicodeCharacter{0119}{\ogonek{e}}%
  9848. \DeclareUnicodeCharacter{011A}{\v{E}}%
  9849. \DeclareUnicodeCharacter{011B}{\v{e}}%
  9850. \DeclareUnicodeCharacter{011C}{\^G}%
  9851. \DeclareUnicodeCharacter{011D}{\^g}%
  9852. \DeclareUnicodeCharacter{011E}{\u{G}}%
  9853. \DeclareUnicodeCharacter{011F}{\u{g}}%
  9854. %
  9855. \DeclareUnicodeCharacter{0120}{\dotaccent{G}}%
  9856. \DeclareUnicodeCharacter{0121}{\dotaccent{g}}%
  9857. \DeclareUnicodeCharacter{0122}{\cedilla{G}}%
  9858. \DeclareUnicodeCharacter{0123}{\cedilla{g}}%
  9859. \DeclareUnicodeCharacter{0124}{\^H}%
  9860. \DeclareUnicodeCharacter{0125}{\^h}%
  9861. \DeclareUnicodeCharacter{0126}{\missingcharmsg{H WITH STROKE}}%
  9862. \DeclareUnicodeCharacter{0127}{\missingcharmsg{h WITH STROKE}}%
  9863. \DeclareUnicodeCharacter{0128}{\~I}%
  9864. \DeclareUnicodeCharacter{0129}{\~{\dotless{i}}}%
  9865. \DeclareUnicodeCharacter{012A}{\=I}%
  9866. \DeclareUnicodeCharacter{012B}{\={\dotless{i}}}%
  9867. \DeclareUnicodeCharacter{012C}{\u{I}}%
  9868. \DeclareUnicodeCharacter{012D}{\u{\dotless{i}}}%
  9869. \DeclareUnicodeCharacter{012E}{\ogonek{I}}%
  9870. \DeclareUnicodeCharacter{012F}{\ogonek{i}}%
  9871. %
  9872. \DeclareUnicodeCharacter{0130}{\dotaccent{I}}%
  9873. \DeclareUnicodeCharacter{0131}{\dotless{i}}%
  9874. \DeclareUnicodeCharacter{0132}{IJ}%
  9875. \DeclareUnicodeCharacter{0133}{ij}%
  9876. \DeclareUnicodeCharacter{0134}{\^J}%
  9877. \DeclareUnicodeCharacter{0135}{\^{\dotless{j}}}%
  9878. \DeclareUnicodeCharacter{0136}{\cedilla{K}}%
  9879. \DeclareUnicodeCharacter{0137}{\cedilla{k}}%
  9880. \DeclareUnicodeCharacter{0138}{\ensuremath\kappa}%
  9881. \DeclareUnicodeCharacter{0139}{\'L}%
  9882. \DeclareUnicodeCharacter{013A}{\'l}%
  9883. \DeclareUnicodeCharacter{013B}{\cedilla{L}}%
  9884. \DeclareUnicodeCharacter{013C}{\cedilla{l}}%
  9885. \DeclareUnicodeCharacter{013D}{L'}% should kern
  9886. \DeclareUnicodeCharacter{013E}{l'}% should kern
  9887. \DeclareUnicodeCharacter{013F}{L\U{00B7}}%
  9888. %
  9889. \DeclareUnicodeCharacter{0140}{l\U{00B7}}%
  9890. \DeclareUnicodeCharacter{0141}{\L}%
  9891. \DeclareUnicodeCharacter{0142}{\l}%
  9892. \DeclareUnicodeCharacter{0143}{\'N}%
  9893. \DeclareUnicodeCharacter{0144}{\'n}%
  9894. \DeclareUnicodeCharacter{0145}{\cedilla{N}}%
  9895. \DeclareUnicodeCharacter{0146}{\cedilla{n}}%
  9896. \DeclareUnicodeCharacter{0147}{\v{N}}%
  9897. \DeclareUnicodeCharacter{0148}{\v{n}}%
  9898. \DeclareUnicodeCharacter{0149}{'n}%
  9899. \DeclareUnicodeCharacter{014A}{\missingcharmsg{ENG}}%
  9900. \DeclareUnicodeCharacter{014B}{\missingcharmsg{eng}}%
  9901. \DeclareUnicodeCharacter{014C}{\=O}%
  9902. \DeclareUnicodeCharacter{014D}{\=o}%
  9903. \DeclareUnicodeCharacter{014E}{\u{O}}%
  9904. \DeclareUnicodeCharacter{014F}{\u{o}}%
  9905. %
  9906. \DeclareUnicodeCharacter{0150}{\H{O}}%
  9907. \DeclareUnicodeCharacter{0151}{\H{o}}%
  9908. \DeclareUnicodeCharacter{0152}{\OE}%
  9909. \DeclareUnicodeCharacter{0153}{\oe}%
  9910. \DeclareUnicodeCharacter{0154}{\'R}%
  9911. \DeclareUnicodeCharacter{0155}{\'r}%
  9912. \DeclareUnicodeCharacter{0156}{\cedilla{R}}%
  9913. \DeclareUnicodeCharacter{0157}{\cedilla{r}}%
  9914. \DeclareUnicodeCharacter{0158}{\v{R}}%
  9915. \DeclareUnicodeCharacter{0159}{\v{r}}%
  9916. \DeclareUnicodeCharacter{015A}{\'S}%
  9917. \DeclareUnicodeCharacter{015B}{\'s}%
  9918. \DeclareUnicodeCharacter{015C}{\^S}%
  9919. \DeclareUnicodeCharacter{015D}{\^s}%
  9920. \DeclareUnicodeCharacter{015E}{\cedilla{S}}%
  9921. \DeclareUnicodeCharacter{015F}{\cedilla{s}}%
  9922. %
  9923. \DeclareUnicodeCharacter{0160}{\v{S}}%
  9924. \DeclareUnicodeCharacter{0161}{\v{s}}%
  9925. \DeclareUnicodeCharacter{0162}{\cedilla{T}}%
  9926. \DeclareUnicodeCharacter{0163}{\cedilla{t}}%
  9927. \DeclareUnicodeCharacter{0164}{\v{T}}%
  9928. \DeclareUnicodeCharacter{0165}{\v{t}}%
  9929. \DeclareUnicodeCharacter{0166}{\missingcharmsg{H WITH STROKE}}%
  9930. \DeclareUnicodeCharacter{0167}{\missingcharmsg{h WITH STROKE}}%
  9931. \DeclareUnicodeCharacter{0168}{\~U}%
  9932. \DeclareUnicodeCharacter{0169}{\~u}%
  9933. \DeclareUnicodeCharacter{016A}{\=U}%
  9934. \DeclareUnicodeCharacter{016B}{\=u}%
  9935. \DeclareUnicodeCharacter{016C}{\u{U}}%
  9936. \DeclareUnicodeCharacter{016D}{\u{u}}%
  9937. \DeclareUnicodeCharacter{016E}{\ringaccent{U}}%
  9938. \DeclareUnicodeCharacter{016F}{\ringaccent{u}}%
  9939. %
  9940. \DeclareUnicodeCharacter{0170}{\H{U}}%
  9941. \DeclareUnicodeCharacter{0171}{\H{u}}%
  9942. \DeclareUnicodeCharacter{0172}{\ogonek{U}}%
  9943. \DeclareUnicodeCharacter{0173}{\ogonek{u}}%
  9944. \DeclareUnicodeCharacter{0174}{\^W}%
  9945. \DeclareUnicodeCharacter{0175}{\^w}%
  9946. \DeclareUnicodeCharacter{0176}{\^Y}%
  9947. \DeclareUnicodeCharacter{0177}{\^y}%
  9948. \DeclareUnicodeCharacter{0178}{\"Y}%
  9949. \DeclareUnicodeCharacter{0179}{\'Z}%
  9950. \DeclareUnicodeCharacter{017A}{\'z}%
  9951. \DeclareUnicodeCharacter{017B}{\dotaccent{Z}}%
  9952. \DeclareUnicodeCharacter{017C}{\dotaccent{z}}%
  9953. \DeclareUnicodeCharacter{017D}{\v{Z}}%
  9954. \DeclareUnicodeCharacter{017E}{\v{z}}%
  9955. \DeclareUnicodeCharacter{017F}{\missingcharmsg{LONG S}}%
  9956. %
  9957. \DeclareUnicodeCharacter{01C4}{D\v{Z}}%
  9958. \DeclareUnicodeCharacter{01C5}{D\v{z}}%
  9959. \DeclareUnicodeCharacter{01C6}{d\v{z}}%
  9960. \DeclareUnicodeCharacter{01C7}{LJ}%
  9961. \DeclareUnicodeCharacter{01C8}{Lj}%
  9962. \DeclareUnicodeCharacter{01C9}{lj}%
  9963. \DeclareUnicodeCharacter{01CA}{NJ}%
  9964. \DeclareUnicodeCharacter{01CB}{Nj}%
  9965. \DeclareUnicodeCharacter{01CC}{nj}%
  9966. \DeclareUnicodeCharacter{01CD}{\v{A}}%
  9967. \DeclareUnicodeCharacter{01CE}{\v{a}}%
  9968. \DeclareUnicodeCharacter{01CF}{\v{I}}%
  9969. %
  9970. \DeclareUnicodeCharacter{01D0}{\v{\dotless{i}}}%
  9971. \DeclareUnicodeCharacter{01D1}{\v{O}}%
  9972. \DeclareUnicodeCharacter{01D2}{\v{o}}%
  9973. \DeclareUnicodeCharacter{01D3}{\v{U}}%
  9974. \DeclareUnicodeCharacter{01D4}{\v{u}}%
  9975. %
  9976. \DeclareUnicodeCharacter{01E2}{\={\AE}}%
  9977. \DeclareUnicodeCharacter{01E3}{\={\ae}}%
  9978. \DeclareUnicodeCharacter{01E6}{\v{G}}%
  9979. \DeclareUnicodeCharacter{01E7}{\v{g}}%
  9980. \DeclareUnicodeCharacter{01E8}{\v{K}}%
  9981. \DeclareUnicodeCharacter{01E9}{\v{k}}%
  9982. %
  9983. \DeclareUnicodeCharacter{01F0}{\v{\dotless{j}}}%
  9984. \DeclareUnicodeCharacter{01F1}{DZ}%
  9985. \DeclareUnicodeCharacter{01F2}{Dz}%
  9986. \DeclareUnicodeCharacter{01F3}{dz}%
  9987. \DeclareUnicodeCharacter{01F4}{\'G}%
  9988. \DeclareUnicodeCharacter{01F5}{\'g}%
  9989. \DeclareUnicodeCharacter{01F8}{\`N}%
  9990. \DeclareUnicodeCharacter{01F9}{\`n}%
  9991. \DeclareUnicodeCharacter{01FC}{\'{\AE}}%
  9992. \DeclareUnicodeCharacter{01FD}{\'{\ae}}%
  9993. \DeclareUnicodeCharacter{01FE}{\'{\O}}%
  9994. \DeclareUnicodeCharacter{01FF}{\'{\o}}%
  9995. %
  9996. \DeclareUnicodeCharacter{021E}{\v{H}}%
  9997. \DeclareUnicodeCharacter{021F}{\v{h}}%
  9998. %
  9999. \DeclareUnicodeCharacter{0226}{\dotaccent{A}}%
  10000. \DeclareUnicodeCharacter{0227}{\dotaccent{a}}%
  10001. \DeclareUnicodeCharacter{0228}{\cedilla{E}}%
  10002. \DeclareUnicodeCharacter{0229}{\cedilla{e}}%
  10003. \DeclareUnicodeCharacter{022E}{\dotaccent{O}}%
  10004. \DeclareUnicodeCharacter{022F}{\dotaccent{o}}%
  10005. %
  10006. \DeclareUnicodeCharacter{0232}{\=Y}%
  10007. \DeclareUnicodeCharacter{0233}{\=y}%
  10008. \DeclareUnicodeCharacter{0237}{\dotless{j}}%
  10009. %
  10010. \DeclareUnicodeCharacter{02DB}{\ogonek{ }}%
  10011. %
  10012. % Greek letters upper case
  10013. \DeclareUnicodeCharacter{0391}{{\it A}}%
  10014. \DeclareUnicodeCharacter{0392}{{\it B}}%
  10015. \DeclareUnicodeCharacter{0393}{\ensuremath{\mit\Gamma}}%
  10016. \DeclareUnicodeCharacter{0394}{\ensuremath{\mit\Delta}}%
  10017. \DeclareUnicodeCharacter{0395}{{\it E}}%
  10018. \DeclareUnicodeCharacter{0396}{{\it Z}}%
  10019. \DeclareUnicodeCharacter{0397}{{\it H}}%
  10020. \DeclareUnicodeCharacter{0398}{\ensuremath{\mit\Theta}}%
  10021. \DeclareUnicodeCharacter{0399}{{\it I}}%
  10022. \DeclareUnicodeCharacter{039A}{{\it K}}%
  10023. \DeclareUnicodeCharacter{039B}{\ensuremath{\mit\Lambda}}%
  10024. \DeclareUnicodeCharacter{039C}{{\it M}}%
  10025. \DeclareUnicodeCharacter{039D}{{\it N}}%
  10026. \DeclareUnicodeCharacter{039E}{\ensuremath{\mit\Xi}}%
  10027. \DeclareUnicodeCharacter{039F}{{\it O}}%
  10028. \DeclareUnicodeCharacter{03A0}{\ensuremath{\mit\Pi}}%
  10029. \DeclareUnicodeCharacter{03A1}{{\it P}}%
  10030. %\DeclareUnicodeCharacter{03A2}{} % none - corresponds to final sigma
  10031. \DeclareUnicodeCharacter{03A3}{\ensuremath{\mit\Sigma}}%
  10032. \DeclareUnicodeCharacter{03A4}{{\it T}}%
  10033. \DeclareUnicodeCharacter{03A5}{\ensuremath{\mit\Upsilon}}%
  10034. \DeclareUnicodeCharacter{03A6}{\ensuremath{\mit\Phi}}%
  10035. \DeclareUnicodeCharacter{03A7}{{\it X}}%
  10036. \DeclareUnicodeCharacter{03A8}{\ensuremath{\mit\Psi}}%
  10037. \DeclareUnicodeCharacter{03A9}{\ensuremath{\mit\Omega}}%
  10038. %
  10039. % Vowels with accents
  10040. \DeclareUnicodeCharacter{0390}{\ensuremath{\ddot{\acute\iota}}}%
  10041. \DeclareUnicodeCharacter{03AC}{\ensuremath{\acute\alpha}}%
  10042. \DeclareUnicodeCharacter{03AD}{\ensuremath{\acute\epsilon}}%
  10043. \DeclareUnicodeCharacter{03AE}{\ensuremath{\acute\eta}}%
  10044. \DeclareUnicodeCharacter{03AF}{\ensuremath{\acute\iota}}%
  10045. \DeclareUnicodeCharacter{03B0}{\ensuremath{\acute{\ddot\upsilon}}}%
  10046. %
  10047. % Standalone accent
  10048. \DeclareUnicodeCharacter{0384}{\ensuremath{\acute{\ }}}%
  10049. %
  10050. % Greek letters lower case
  10051. \DeclareUnicodeCharacter{03B1}{\ensuremath\alpha}%
  10052. \DeclareUnicodeCharacter{03B2}{\ensuremath\beta}%
  10053. \DeclareUnicodeCharacter{03B3}{\ensuremath\gamma}%
  10054. \DeclareUnicodeCharacter{03B4}{\ensuremath\delta}%
  10055. \DeclareUnicodeCharacter{03B5}{\ensuremath\epsilon}%
  10056. \DeclareUnicodeCharacter{03B6}{\ensuremath\zeta}%
  10057. \DeclareUnicodeCharacter{03B7}{\ensuremath\eta}%
  10058. \DeclareUnicodeCharacter{03B8}{\ensuremath\theta}%
  10059. \DeclareUnicodeCharacter{03B9}{\ensuremath\iota}%
  10060. \DeclareUnicodeCharacter{03BA}{\ensuremath\kappa}%
  10061. \DeclareUnicodeCharacter{03BB}{\ensuremath\lambda}%
  10062. \DeclareUnicodeCharacter{03BC}{\ensuremath\mu}%
  10063. \DeclareUnicodeCharacter{03BD}{\ensuremath\nu}%
  10064. \DeclareUnicodeCharacter{03BE}{\ensuremath\xi}%
  10065. \DeclareUnicodeCharacter{03BF}{{\it o}}% omicron
  10066. \DeclareUnicodeCharacter{03C0}{\ensuremath\pi}%
  10067. \DeclareUnicodeCharacter{03C1}{\ensuremath\rho}%
  10068. \DeclareUnicodeCharacter{03C2}{\ensuremath\varsigma}%
  10069. \DeclareUnicodeCharacter{03C3}{\ensuremath\sigma}%
  10070. \DeclareUnicodeCharacter{03C4}{\ensuremath\tau}%
  10071. \DeclareUnicodeCharacter{03C5}{\ensuremath\upsilon}%
  10072. \DeclareUnicodeCharacter{03C6}{\ensuremath\phi}%
  10073. \DeclareUnicodeCharacter{03C7}{\ensuremath\chi}%
  10074. \DeclareUnicodeCharacter{03C8}{\ensuremath\psi}%
  10075. \DeclareUnicodeCharacter{03C9}{\ensuremath\omega}%
  10076. %
  10077. % More Greek vowels with accents
  10078. \DeclareUnicodeCharacter{03CA}{\ensuremath{\ddot\iota}}%
  10079. \DeclareUnicodeCharacter{03CB}{\ensuremath{\ddot\upsilon}}%
  10080. \DeclareUnicodeCharacter{03CC}{\ensuremath{\acute o}}%
  10081. \DeclareUnicodeCharacter{03CD}{\ensuremath{\acute\upsilon}}%
  10082. \DeclareUnicodeCharacter{03CE}{\ensuremath{\acute\omega}}%
  10083. %
  10084. % Variant Greek letters
  10085. \DeclareUnicodeCharacter{03D1}{\ensuremath\vartheta}%
  10086. \DeclareUnicodeCharacter{03D6}{\ensuremath\varpi}%
  10087. \DeclareUnicodeCharacter{03F1}{\ensuremath\varrho}%
  10088. %
  10089. \DeclareUnicodeCharacter{1E02}{\dotaccent{B}}%
  10090. \DeclareUnicodeCharacter{1E03}{\dotaccent{b}}%
  10091. \DeclareUnicodeCharacter{1E04}{\udotaccent{B}}%
  10092. \DeclareUnicodeCharacter{1E05}{\udotaccent{b}}%
  10093. \DeclareUnicodeCharacter{1E06}{\ubaraccent{B}}%
  10094. \DeclareUnicodeCharacter{1E07}{\ubaraccent{b}}%
  10095. \DeclareUnicodeCharacter{1E0A}{\dotaccent{D}}%
  10096. \DeclareUnicodeCharacter{1E0B}{\dotaccent{d}}%
  10097. \DeclareUnicodeCharacter{1E0C}{\udotaccent{D}}%
  10098. \DeclareUnicodeCharacter{1E0D}{\udotaccent{d}}%
  10099. \DeclareUnicodeCharacter{1E0E}{\ubaraccent{D}}%
  10100. \DeclareUnicodeCharacter{1E0F}{\ubaraccent{d}}%
  10101. %
  10102. \DeclareUnicodeCharacter{1E1E}{\dotaccent{F}}%
  10103. \DeclareUnicodeCharacter{1E1F}{\dotaccent{f}}%
  10104. %
  10105. \DeclareUnicodeCharacter{1E20}{\=G}%
  10106. \DeclareUnicodeCharacter{1E21}{\=g}%
  10107. \DeclareUnicodeCharacter{1E22}{\dotaccent{H}}%
  10108. \DeclareUnicodeCharacter{1E23}{\dotaccent{h}}%
  10109. \DeclareUnicodeCharacter{1E24}{\udotaccent{H}}%
  10110. \DeclareUnicodeCharacter{1E25}{\udotaccent{h}}%
  10111. \DeclareUnicodeCharacter{1E26}{\"H}%
  10112. \DeclareUnicodeCharacter{1E27}{\"h}%
  10113. %
  10114. \DeclareUnicodeCharacter{1E30}{\'K}%
  10115. \DeclareUnicodeCharacter{1E31}{\'k}%
  10116. \DeclareUnicodeCharacter{1E32}{\udotaccent{K}}%
  10117. \DeclareUnicodeCharacter{1E33}{\udotaccent{k}}%
  10118. \DeclareUnicodeCharacter{1E34}{\ubaraccent{K}}%
  10119. \DeclareUnicodeCharacter{1E35}{\ubaraccent{k}}%
  10120. \DeclareUnicodeCharacter{1E36}{\udotaccent{L}}%
  10121. \DeclareUnicodeCharacter{1E37}{\udotaccent{l}}%
  10122. \DeclareUnicodeCharacter{1E3A}{\ubaraccent{L}}%
  10123. \DeclareUnicodeCharacter{1E3B}{\ubaraccent{l}}%
  10124. \DeclareUnicodeCharacter{1E3E}{\'M}%
  10125. \DeclareUnicodeCharacter{1E3F}{\'m}%
  10126. %
  10127. \DeclareUnicodeCharacter{1E40}{\dotaccent{M}}%
  10128. \DeclareUnicodeCharacter{1E41}{\dotaccent{m}}%
  10129. \DeclareUnicodeCharacter{1E42}{\udotaccent{M}}%
  10130. \DeclareUnicodeCharacter{1E43}{\udotaccent{m}}%
  10131. \DeclareUnicodeCharacter{1E44}{\dotaccent{N}}%
  10132. \DeclareUnicodeCharacter{1E45}{\dotaccent{n}}%
  10133. \DeclareUnicodeCharacter{1E46}{\udotaccent{N}}%
  10134. \DeclareUnicodeCharacter{1E47}{\udotaccent{n}}%
  10135. \DeclareUnicodeCharacter{1E48}{\ubaraccent{N}}%
  10136. \DeclareUnicodeCharacter{1E49}{\ubaraccent{n}}%
  10137. %
  10138. \DeclareUnicodeCharacter{1E54}{\'P}%
  10139. \DeclareUnicodeCharacter{1E55}{\'p}%
  10140. \DeclareUnicodeCharacter{1E56}{\dotaccent{P}}%
  10141. \DeclareUnicodeCharacter{1E57}{\dotaccent{p}}%
  10142. \DeclareUnicodeCharacter{1E58}{\dotaccent{R}}%
  10143. \DeclareUnicodeCharacter{1E59}{\dotaccent{r}}%
  10144. \DeclareUnicodeCharacter{1E5A}{\udotaccent{R}}%
  10145. \DeclareUnicodeCharacter{1E5B}{\udotaccent{r}}%
  10146. \DeclareUnicodeCharacter{1E5E}{\ubaraccent{R}}%
  10147. \DeclareUnicodeCharacter{1E5F}{\ubaraccent{r}}%
  10148. %
  10149. \DeclareUnicodeCharacter{1E60}{\dotaccent{S}}%
  10150. \DeclareUnicodeCharacter{1E61}{\dotaccent{s}}%
  10151. \DeclareUnicodeCharacter{1E62}{\udotaccent{S}}%
  10152. \DeclareUnicodeCharacter{1E63}{\udotaccent{s}}%
  10153. \DeclareUnicodeCharacter{1E6A}{\dotaccent{T}}%
  10154. \DeclareUnicodeCharacter{1E6B}{\dotaccent{t}}%
  10155. \DeclareUnicodeCharacter{1E6C}{\udotaccent{T}}%
  10156. \DeclareUnicodeCharacter{1E6D}{\udotaccent{t}}%
  10157. \DeclareUnicodeCharacter{1E6E}{\ubaraccent{T}}%
  10158. \DeclareUnicodeCharacter{1E6F}{\ubaraccent{t}}%
  10159. %
  10160. \DeclareUnicodeCharacter{1E7C}{\~V}%
  10161. \DeclareUnicodeCharacter{1E7D}{\~v}%
  10162. \DeclareUnicodeCharacter{1E7E}{\udotaccent{V}}%
  10163. \DeclareUnicodeCharacter{1E7F}{\udotaccent{v}}%
  10164. %
  10165. \DeclareUnicodeCharacter{1E80}{\`W}%
  10166. \DeclareUnicodeCharacter{1E81}{\`w}%
  10167. \DeclareUnicodeCharacter{1E82}{\'W}%
  10168. \DeclareUnicodeCharacter{1E83}{\'w}%
  10169. \DeclareUnicodeCharacter{1E84}{\"W}%
  10170. \DeclareUnicodeCharacter{1E85}{\"w}%
  10171. \DeclareUnicodeCharacter{1E86}{\dotaccent{W}}%
  10172. \DeclareUnicodeCharacter{1E87}{\dotaccent{w}}%
  10173. \DeclareUnicodeCharacter{1E88}{\udotaccent{W}}%
  10174. \DeclareUnicodeCharacter{1E89}{\udotaccent{w}}%
  10175. \DeclareUnicodeCharacter{1E8A}{\dotaccent{X}}%
  10176. \DeclareUnicodeCharacter{1E8B}{\dotaccent{x}}%
  10177. \DeclareUnicodeCharacter{1E8C}{\"X}%
  10178. \DeclareUnicodeCharacter{1E8D}{\"x}%
  10179. \DeclareUnicodeCharacter{1E8E}{\dotaccent{Y}}%
  10180. \DeclareUnicodeCharacter{1E8F}{\dotaccent{y}}%
  10181. %
  10182. \DeclareUnicodeCharacter{1E90}{\^Z}%
  10183. \DeclareUnicodeCharacter{1E91}{\^z}%
  10184. \DeclareUnicodeCharacter{1E92}{\udotaccent{Z}}%
  10185. \DeclareUnicodeCharacter{1E93}{\udotaccent{z}}%
  10186. \DeclareUnicodeCharacter{1E94}{\ubaraccent{Z}}%
  10187. \DeclareUnicodeCharacter{1E95}{\ubaraccent{z}}%
  10188. \DeclareUnicodeCharacter{1E96}{\ubaraccent{h}}%
  10189. \DeclareUnicodeCharacter{1E97}{\"t}%
  10190. \DeclareUnicodeCharacter{1E98}{\ringaccent{w}}%
  10191. \DeclareUnicodeCharacter{1E99}{\ringaccent{y}}%
  10192. %
  10193. \DeclareUnicodeCharacter{1EA0}{\udotaccent{A}}%
  10194. \DeclareUnicodeCharacter{1EA1}{\udotaccent{a}}%
  10195. %
  10196. \DeclareUnicodeCharacter{1EB8}{\udotaccent{E}}%
  10197. \DeclareUnicodeCharacter{1EB9}{\udotaccent{e}}%
  10198. \DeclareUnicodeCharacter{1EBC}{\~E}%
  10199. \DeclareUnicodeCharacter{1EBD}{\~e}%
  10200. %
  10201. \DeclareUnicodeCharacter{1ECA}{\udotaccent{I}}%
  10202. \DeclareUnicodeCharacter{1ECB}{\udotaccent{i}}%
  10203. \DeclareUnicodeCharacter{1ECC}{\udotaccent{O}}%
  10204. \DeclareUnicodeCharacter{1ECD}{\udotaccent{o}}%
  10205. %
  10206. \DeclareUnicodeCharacter{1EE4}{\udotaccent{U}}%
  10207. \DeclareUnicodeCharacter{1EE5}{\udotaccent{u}}%
  10208. %
  10209. \DeclareUnicodeCharacter{1EF2}{\`Y}%
  10210. \DeclareUnicodeCharacter{1EF3}{\`y}%
  10211. \DeclareUnicodeCharacter{1EF4}{\udotaccent{Y}}%
  10212. %
  10213. \DeclareUnicodeCharacter{1EF8}{\~Y}%
  10214. \DeclareUnicodeCharacter{1EF9}{\~y}%
  10215. %
  10216. % Punctuation
  10217. \DeclareUnicodeCharacter{2013}{--}%
  10218. \DeclareUnicodeCharacter{2014}{---}%
  10219. \DeclareUnicodeCharacter{2018}{\quoteleft{}}%
  10220. \DeclareUnicodeCharacter{2019}{\quoteright{}}%
  10221. \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}%
  10222. \DeclareUnicodeCharacter{201C}{\quotedblleft{}}%
  10223. \DeclareUnicodeCharacter{201D}{\quotedblright{}}%
  10224. \DeclareUnicodeCharacter{201E}{\quotedblbase{}}%
  10225. \DeclareUnicodeCharacter{2020}{\ensuremath\dagger}%
  10226. \DeclareUnicodeCharacter{2021}{\ensuremath\ddagger}%
  10227. \DeclareUnicodeCharacter{2022}{\bullet{}}%
  10228. \DeclareUnicodeCharacter{202F}{\thinspace}%
  10229. \DeclareUnicodeCharacter{2026}{\dots{}}%
  10230. \DeclareUnicodeCharacter{2039}{\guilsinglleft{}}%
  10231. \DeclareUnicodeCharacter{203A}{\guilsinglright{}}%
  10232. %
  10233. \DeclareUnicodeCharacter{20AC}{\euro{}}%
  10234. %
  10235. \DeclareUnicodeCharacter{2192}{\expansion{}}%
  10236. \DeclareUnicodeCharacter{21D2}{\result{}}%
  10237. %
  10238. % Mathematical symbols
  10239. \DeclareUnicodeCharacter{2200}{\ensuremath\forall}%
  10240. \DeclareUnicodeCharacter{2203}{\ensuremath\exists}%
  10241. \DeclareUnicodeCharacter{2208}{\ensuremath\in}%
  10242. \DeclareUnicodeCharacter{2212}{\minus{}}%
  10243. \DeclareUnicodeCharacter{2217}{\ast}%
  10244. \DeclareUnicodeCharacter{221E}{\ensuremath\infty}%
  10245. \DeclareUnicodeCharacter{2225}{\ensuremath\parallel}%
  10246. \DeclareUnicodeCharacter{2227}{\ensuremath\wedge}%
  10247. \DeclareUnicodeCharacter{2229}{\ensuremath\cap}%
  10248. \DeclareUnicodeCharacter{2261}{\equiv{}}%
  10249. \DeclareUnicodeCharacter{2264}{\ensuremath\leq}%
  10250. \DeclareUnicodeCharacter{2265}{\ensuremath\geq}%
  10251. \DeclareUnicodeCharacter{2282}{\ensuremath\subset}%
  10252. \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}%
  10253. %
  10254. \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}%
  10255. \DeclareUnicodeCharacter{2032}{\ensuremath\prime}%
  10256. \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}%
  10257. \DeclareUnicodeCharacter{2111}{\ensuremath\Im}%
  10258. \DeclareUnicodeCharacter{2113}{\ensuremath\ell}%
  10259. \DeclareUnicodeCharacter{2118}{\ensuremath\wp}%
  10260. \DeclareUnicodeCharacter{211C}{\ensuremath\Re}%
  10261. \DeclareUnicodeCharacter{2135}{\ensuremath\aleph}%
  10262. \DeclareUnicodeCharacter{2190}{\ensuremath\leftarrow}%
  10263. \DeclareUnicodeCharacter{2191}{\ensuremath\uparrow}%
  10264. \DeclareUnicodeCharacter{2193}{\ensuremath\downarrow}%
  10265. \DeclareUnicodeCharacter{2194}{\ensuremath\leftrightarrow}%
  10266. \DeclareUnicodeCharacter{2195}{\ensuremath\updownarrow}%
  10267. \DeclareUnicodeCharacter{2196}{\ensuremath\nwarrow}%
  10268. \DeclareUnicodeCharacter{2197}{\ensuremath\nearrow}%
  10269. \DeclareUnicodeCharacter{2198}{\ensuremath\searrow}%
  10270. \DeclareUnicodeCharacter{2199}{\ensuremath\swarrow}%
  10271. \DeclareUnicodeCharacter{21A6}{\ensuremath\mapsto}%
  10272. \DeclareUnicodeCharacter{21A9}{\ensuremath\hookleftarrow}%
  10273. \DeclareUnicodeCharacter{21AA}{\ensuremath\hookrightarrow}%
  10274. \DeclareUnicodeCharacter{21BC}{\ensuremath\leftharpoonup}%
  10275. \DeclareUnicodeCharacter{21BD}{\ensuremath\leftharpoondown}%
  10276. \DeclareUnicodeCharacter{21C0}{\ensuremath\rightharpoonup}%
  10277. \DeclareUnicodeCharacter{21C1}{\ensuremath\rightharpoondown}%
  10278. \DeclareUnicodeCharacter{21CC}{\ensuremath\rightleftharpoons}%
  10279. \DeclareUnicodeCharacter{21D0}{\ensuremath\Leftarrow}%
  10280. \DeclareUnicodeCharacter{21D1}{\ensuremath\Uparrow}%
  10281. \DeclareUnicodeCharacter{21D3}{\ensuremath\Downarrow}%
  10282. \DeclareUnicodeCharacter{21D4}{\ensuremath\Leftrightarrow}%
  10283. \DeclareUnicodeCharacter{21D5}{\ensuremath\Updownarrow}%
  10284. \DeclareUnicodeCharacter{2202}{\ensuremath\partial}%
  10285. \DeclareUnicodeCharacter{2205}{\ensuremath\emptyset}%
  10286. \DeclareUnicodeCharacter{2207}{\ensuremath\nabla}%
  10287. \DeclareUnicodeCharacter{2209}{\ensuremath\notin}%
  10288. \DeclareUnicodeCharacter{220B}{\ensuremath\owns}%
  10289. \DeclareUnicodeCharacter{220F}{\ensuremath\prod}%
  10290. \DeclareUnicodeCharacter{2210}{\ensuremath\coprod}%
  10291. \DeclareUnicodeCharacter{2211}{\ensuremath\sum}%
  10292. \DeclareUnicodeCharacter{2213}{\ensuremath\mp}%
  10293. \DeclareUnicodeCharacter{2218}{\ensuremath\circ}%
  10294. \DeclareUnicodeCharacter{221A}{\ensuremath\surd}%
  10295. \DeclareUnicodeCharacter{221D}{\ensuremath\propto}%
  10296. \DeclareUnicodeCharacter{2220}{\ensuremath\angle}%
  10297. \DeclareUnicodeCharacter{2223}{\ensuremath\mid}%
  10298. \DeclareUnicodeCharacter{2228}{\ensuremath\vee}%
  10299. \DeclareUnicodeCharacter{222A}{\ensuremath\cup}%
  10300. \DeclareUnicodeCharacter{222B}{\ensuremath\smallint}%
  10301. \DeclareUnicodeCharacter{222E}{\ensuremath\oint}%
  10302. \DeclareUnicodeCharacter{223C}{\ensuremath\sim}%
  10303. \DeclareUnicodeCharacter{2240}{\ensuremath\wr}%
  10304. \DeclareUnicodeCharacter{2243}{\ensuremath\simeq}%
  10305. \DeclareUnicodeCharacter{2245}{\ensuremath\cong}%
  10306. \DeclareUnicodeCharacter{2248}{\ensuremath\approx}%
  10307. \DeclareUnicodeCharacter{224D}{\ensuremath\asymp}%
  10308. \DeclareUnicodeCharacter{2250}{\ensuremath\doteq}%
  10309. \DeclareUnicodeCharacter{2260}{\ensuremath\neq}%
  10310. \DeclareUnicodeCharacter{226A}{\ensuremath\ll}%
  10311. \DeclareUnicodeCharacter{226B}{\ensuremath\gg}%
  10312. \DeclareUnicodeCharacter{227A}{\ensuremath\prec}%
  10313. \DeclareUnicodeCharacter{227B}{\ensuremath\succ}%
  10314. \DeclareUnicodeCharacter{2283}{\ensuremath\supset}%
  10315. \DeclareUnicodeCharacter{2286}{\ensuremath\subseteq}%
  10316. \DeclareUnicodeCharacter{228E}{\ensuremath\uplus}%
  10317. \DeclareUnicodeCharacter{2291}{\ensuremath\sqsubseteq}%
  10318. \DeclareUnicodeCharacter{2292}{\ensuremath\sqsupseteq}%
  10319. \DeclareUnicodeCharacter{2293}{\ensuremath\sqcap}%
  10320. \DeclareUnicodeCharacter{2294}{\ensuremath\sqcup}%
  10321. \DeclareUnicodeCharacter{2295}{\ensuremath\oplus}%
  10322. \DeclareUnicodeCharacter{2296}{\ensuremath\ominus}%
  10323. \DeclareUnicodeCharacter{2297}{\ensuremath\otimes}%
  10324. \DeclareUnicodeCharacter{2298}{\ensuremath\oslash}%
  10325. \DeclareUnicodeCharacter{2299}{\ensuremath\odot}%
  10326. \DeclareUnicodeCharacter{22A2}{\ensuremath\vdash}%
  10327. \DeclareUnicodeCharacter{22A3}{\ensuremath\dashv}%
  10328. \DeclareUnicodeCharacter{22A4}{\ensuremath\ptextop}%
  10329. \DeclareUnicodeCharacter{22A5}{\ensuremath\bot}%
  10330. \DeclareUnicodeCharacter{22A8}{\ensuremath\models}%
  10331. \DeclareUnicodeCharacter{22C0}{\ensuremath\bigwedge}%
  10332. \DeclareUnicodeCharacter{22C1}{\ensuremath\bigvee}%
  10333. \DeclareUnicodeCharacter{22C2}{\ensuremath\bigcap}%
  10334. \DeclareUnicodeCharacter{22C3}{\ensuremath\bigcup}%
  10335. \DeclareUnicodeCharacter{22C4}{\ensuremath\diamond}%
  10336. \DeclareUnicodeCharacter{22C5}{\ensuremath\cdot}%
  10337. \DeclareUnicodeCharacter{22C6}{\ensuremath\star}%
  10338. \DeclareUnicodeCharacter{22C8}{\ensuremath\bowtie}%
  10339. \DeclareUnicodeCharacter{2308}{\ensuremath\lceil}%
  10340. \DeclareUnicodeCharacter{2309}{\ensuremath\rceil}%
  10341. \DeclareUnicodeCharacter{230A}{\ensuremath\lfloor}%
  10342. \DeclareUnicodeCharacter{230B}{\ensuremath\rfloor}%
  10343. \DeclareUnicodeCharacter{2322}{\ensuremath\frown}%
  10344. \DeclareUnicodeCharacter{2323}{\ensuremath\smile}%
  10345. %
  10346. \DeclareUnicodeCharacter{25B3}{\ensuremath\triangle}%
  10347. \DeclareUnicodeCharacter{25B7}{\ensuremath\triangleright}%
  10348. \DeclareUnicodeCharacter{25BD}{\ensuremath\bigtriangledown}%
  10349. \DeclareUnicodeCharacter{25C1}{\ensuremath\triangleleft}%
  10350. \DeclareUnicodeCharacter{25C7}{\ensuremath\diamond}%
  10351. \DeclareUnicodeCharacter{2660}{\ensuremath\spadesuit}%
  10352. \DeclareUnicodeCharacter{2661}{\ensuremath\heartsuit}%
  10353. \DeclareUnicodeCharacter{2662}{\ensuremath\diamondsuit}%
  10354. \DeclareUnicodeCharacter{2663}{\ensuremath\clubsuit}%
  10355. \DeclareUnicodeCharacter{266D}{\ensuremath\flat}%
  10356. \DeclareUnicodeCharacter{266E}{\ensuremath\natural}%
  10357. \DeclareUnicodeCharacter{266F}{\ensuremath\sharp}%
  10358. \DeclareUnicodeCharacter{26AA}{\ensuremath\bigcirc}%
  10359. \DeclareUnicodeCharacter{27B9}{\ensuremath\rangle}%
  10360. \DeclareUnicodeCharacter{27C2}{\ensuremath\perp}%
  10361. \DeclareUnicodeCharacter{27E8}{\ensuremath\langle}%
  10362. \DeclareUnicodeCharacter{27F5}{\ensuremath\longleftarrow}%
  10363. \DeclareUnicodeCharacter{27F6}{\ensuremath\longrightarrow}%
  10364. \DeclareUnicodeCharacter{27F7}{\ensuremath\longleftrightarrow}%
  10365. \DeclareUnicodeCharacter{27FC}{\ensuremath\longmapsto}%
  10366. \DeclareUnicodeCharacter{29F5}{\ensuremath\setminus}%
  10367. \DeclareUnicodeCharacter{2A00}{\ensuremath\bigodot}%
  10368. \DeclareUnicodeCharacter{2A01}{\ensuremath\bigoplus}%
  10369. \DeclareUnicodeCharacter{2A02}{\ensuremath\bigotimes}%
  10370. \DeclareUnicodeCharacter{2A04}{\ensuremath\biguplus}%
  10371. \DeclareUnicodeCharacter{2A06}{\ensuremath\bigsqcup}%
  10372. \DeclareUnicodeCharacter{2A3F}{\ensuremath\amalg}%
  10373. \DeclareUnicodeCharacter{2AAF}{\ensuremath\preceq}%
  10374. \DeclareUnicodeCharacter{2AB0}{\ensuremath\succeq}%
  10375. %
  10376. \global\mathchardef\checkmark="1370% actually the square root sign
  10377. \DeclareUnicodeCharacter{2713}{\ensuremath\checkmark}%
  10378. }% end of \unicodechardefs
  10379. % UTF-8 byte sequence (pdfTeX) definitions (replacing and @U command)
  10380. % It makes the setting that replace UTF-8 byte sequence.
  10381. \def\utfeightchardefs{%
  10382. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterUTFviii
  10383. \unicodechardefs
  10384. }
  10385. % Whether the active definitions of non-ASCII characters expand to
  10386. % non-active tokens with the same character code. This is used to
  10387. % write characters literally, instead of using active definitions for
  10388. % printing the correct glyphs.
  10389. \newif\ifpassthroughchars
  10390. \passthroughcharsfalse
  10391. % For native Unicode handling (XeTeX and LuaTeX),
  10392. % provide a definition macro to replace/pass-through a Unicode character
  10393. %
  10394. \def\DeclareUnicodeCharacterNative#1#2{%
  10395. \catcode"#1=\active
  10396. \def\dodeclareunicodecharacternative##1##2##3{%
  10397. \begingroup
  10398. \uccode`\~="##2\relax
  10399. \uppercase{\gdef~}{%
  10400. \ifpassthroughchars
  10401. ##1%
  10402. \else
  10403. ##3%
  10404. \fi
  10405. }
  10406. \endgroup
  10407. }
  10408. \begingroup
  10409. \uccode`\.="#1\relax
  10410. \uppercase{\def\UTFNativeTmp{.}}%
  10411. \expandafter\dodeclareunicodecharacternative\UTFNativeTmp{#1}{#2}%
  10412. \endgroup
  10413. }
  10414. % Native Unicode handling (XeTeX and LuaTeX) character replacing definition.
  10415. % It activates the setting that replaces Unicode characters.
  10416. \def\nativeunicodechardefs{%
  10417. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNative
  10418. \unicodechardefs
  10419. }
  10420. % For native Unicode handling (XeTeX and LuaTeX),
  10421. % make the character token expand
  10422. % to the sequences given in \unicodechardefs for printing.
  10423. \def\DeclareUnicodeCharacterNativeAtU#1#2{%
  10424. \def\UTFAtUTmp{#2}
  10425. \expandafter\globallet\csname uni:#1\endcsname \UTFAtUTmp
  10426. }
  10427. % @U command definitions for native Unicode handling (XeTeX and LuaTeX).
  10428. \def\nativeunicodechardefsatu{%
  10429. \let\DeclareUnicodeCharacter\DeclareUnicodeCharacterNativeAtU
  10430. \unicodechardefs
  10431. }
  10432. % US-ASCII character definitions.
  10433. \def\asciichardefs{% nothing need be done
  10434. \relax
  10435. }
  10436. % define all Unicode characters we know about, for the sake of @U.
  10437. \iftxinativeunicodecapable
  10438. \nativeunicodechardefsatu
  10439. \else
  10440. \utfeightchardefs
  10441. \fi
  10442. % Make non-ASCII characters printable again for compatibility with
  10443. % existing Texinfo documents that may use them, even without declaring a
  10444. % document encoding.
  10445. %
  10446. \setnonasciicharscatcode \other
  10447. \message{formatting,}
  10448. \newdimen\defaultparindent \defaultparindent = 15pt
  10449. \chapheadingskip = 15pt plus 4pt minus 2pt
  10450. \secheadingskip = 12pt plus 3pt minus 2pt
  10451. \subsecheadingskip = 9pt plus 2pt minus 2pt
  10452. % Prevent underfull vbox error messages.
  10453. \vbadness = 10000
  10454. % Don't be very finicky about underfull hboxes, either.
  10455. \hbadness = 6666
  10456. % Following George Bush, get rid of widows and orphans.
  10457. \widowpenalty=10000
  10458. \clubpenalty=10000
  10459. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  10460. % using an old version of TeX, don't do anything. We want the amount of
  10461. % stretch added to depend on the line length, hence the dependence on
  10462. % \hsize. We call this whenever the paper size is set.
  10463. %
  10464. \def\setemergencystretch{%
  10465. \ifx\emergencystretch\thisisundefined
  10466. % Allow us to assign to \emergencystretch anyway.
  10467. \def\emergencystretch{\dimen0}%
  10468. \else
  10469. \emergencystretch = .15\hsize
  10470. \fi
  10471. }
  10472. % Parameters in order: 1) textheight; 2) textwidth;
  10473. % 3) voffset; 4) hoffset; 5) binding offset; 6) topskip;
  10474. % 7) physical page height; 8) physical page width.
  10475. %
  10476. % We also call \setleading{\textleading}, so the caller should define
  10477. % \textleading. The caller should also set \parskip.
  10478. %
  10479. \def\internalpagesizes#1#2#3#4#5#6#7#8{%
  10480. \voffset = #3\relax
  10481. \topskip = #6\relax
  10482. \splittopskip = \topskip
  10483. %
  10484. \vsize = #1\relax
  10485. \advance\vsize by \topskip
  10486. \outervsize = \vsize
  10487. \advance\outervsize by 2\topandbottommargin
  10488. \txipageheight = \vsize
  10489. %
  10490. \hsize = #2\relax
  10491. \outerhsize = \hsize
  10492. \advance\outerhsize by 0.5in
  10493. \txipagewidth = \hsize
  10494. %
  10495. \normaloffset = #4\relax
  10496. \bindingoffset = #5\relax
  10497. %
  10498. \ifpdf
  10499. \pdfpageheight #7\relax
  10500. \pdfpagewidth #8\relax
  10501. % if we don't reset these, they will remain at "1 true in" of
  10502. % whatever layout pdftex was dumped with.
  10503. \pdfhorigin = 1 true in
  10504. \pdfvorigin = 1 true in
  10505. \else
  10506. \ifx\XeTeXrevision\thisisundefined
  10507. \special{papersize=#8,#7}%
  10508. \else
  10509. \pdfpageheight #7\relax
  10510. \pdfpagewidth #8\relax
  10511. % XeTeX does not have \pdfhorigin and \pdfvorigin.
  10512. \fi
  10513. \fi
  10514. %
  10515. \setleading{\textleading}
  10516. %
  10517. \parindent = \defaultparindent
  10518. \setemergencystretch
  10519. }
  10520. % @letterpaper (the default).
  10521. \def\letterpaper{{\globaldefs = 1
  10522. \parskip = 3pt plus 2pt minus 1pt
  10523. \textleading = 13.2pt
  10524. %
  10525. % If page is nothing but text, make it come out even.
  10526. \internalpagesizes{607.2pt}{6in}% that's 46 lines
  10527. {\voffset}{.25in}%
  10528. {\bindingoffset}{36pt}%
  10529. {11in}{8.5in}%
  10530. }}
  10531. % Use @smallbook to reset parameters for 7x9.25 trim size.
  10532. \def\smallbook{{\globaldefs = 1
  10533. \parskip = 2pt plus 1pt
  10534. \textleading = 12pt
  10535. %
  10536. \internalpagesizes{7.5in}{5in}%
  10537. {-.2in}{0in}%
  10538. {\bindingoffset}{16pt}%
  10539. {9.25in}{7in}%
  10540. %
  10541. \lispnarrowing = 0.3in
  10542. \tolerance = 700
  10543. \contentsrightmargin = 0pt
  10544. \defbodyindent = .5cm
  10545. }}
  10546. % Use @smallerbook to reset parameters for 6x9 trim size.
  10547. % (Just testing, parameters still in flux.)
  10548. \def\smallerbook{{\globaldefs = 1
  10549. \parskip = 1.5pt plus 1pt
  10550. \textleading = 12pt
  10551. %
  10552. \internalpagesizes{7.4in}{4.8in}%
  10553. {-.2in}{-.4in}%
  10554. {0pt}{14pt}%
  10555. {9in}{6in}%
  10556. %
  10557. \lispnarrowing = 0.25in
  10558. \tolerance = 700
  10559. \contentsrightmargin = 0pt
  10560. \defbodyindent = .4cm
  10561. }}
  10562. % Use @afourpaper to print on European A4 paper.
  10563. \def\afourpaper{{\globaldefs = 1
  10564. \parskip = 3pt plus 2pt minus 1pt
  10565. \textleading = 13.2pt
  10566. %
  10567. % Double-side printing via postscript on Laserjet 4050
  10568. % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm.
  10569. % To change the settings for a different printer or situation, adjust
  10570. % \normaloffset until the front-side and back-side texts align. Then
  10571. % do the same for \bindingoffset. You can set these for testing in
  10572. % your texinfo source file like this:
  10573. % @tex
  10574. % \global\normaloffset = -6mm
  10575. % \global\bindingoffset = 10mm
  10576. % @end tex
  10577. \internalpagesizes{673.2pt}{160mm}% that's 51 lines
  10578. {\voffset}{\hoffset}%
  10579. {\bindingoffset}{44pt}%
  10580. {297mm}{210mm}%
  10581. %
  10582. \tolerance = 700
  10583. \contentsrightmargin = 0pt
  10584. \defbodyindent = 5mm
  10585. }}
  10586. % Use @afivepaper to print on European A5 paper.
  10587. % From romildo@urano.iceb.ufop.br, 2 July 2000.
  10588. % He also recommends making @example and @lisp be small.
  10589. \def\afivepaper{{\globaldefs = 1
  10590. \parskip = 2pt plus 1pt minus 0.1pt
  10591. \textleading = 12.5pt
  10592. %
  10593. \internalpagesizes{160mm}{120mm}%
  10594. {\voffset}{\hoffset}%
  10595. {\bindingoffset}{8pt}%
  10596. {210mm}{148mm}%
  10597. %
  10598. \lispnarrowing = 0.2in
  10599. \tolerance = 800
  10600. \contentsrightmargin = 0pt
  10601. \defbodyindent = 2mm
  10602. \tableindent = 12mm
  10603. }}
  10604. % A specific text layout, 24x15cm overall, intended for A4 paper.
  10605. \def\afourlatex{{\globaldefs = 1
  10606. \afourpaper
  10607. \internalpagesizes{237mm}{150mm}%
  10608. {\voffset}{4.6mm}%
  10609. {\bindingoffset}{7mm}%
  10610. {297mm}{210mm}%
  10611. %
  10612. % Must explicitly reset to 0 because we call \afourpaper.
  10613. \globaldefs = 0
  10614. }}
  10615. % Use @afourwide to print on A4 paper in landscape format.
  10616. \def\afourwide{{\globaldefs = 1
  10617. \afourpaper
  10618. \internalpagesizes{241mm}{165mm}%
  10619. {\voffset}{-2.95mm}%
  10620. {\bindingoffset}{7mm}%
  10621. {297mm}{210mm}%
  10622. \globaldefs = 0
  10623. }}
  10624. % @pagesizes TEXTHEIGHT[,TEXTWIDTH]
  10625. % Perhaps we should allow setting the margins, \topskip, \parskip,
  10626. % and/or leading, also. Or perhaps we should compute them somehow.
  10627. %
  10628. \parseargdef\pagesizes{\pagesizesyyy #1,,\finish}
  10629. \def\pagesizesyyy#1,#2,#3\finish{{%
  10630. \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi
  10631. \globaldefs = 1
  10632. %
  10633. \parskip = 3pt plus 2pt minus 1pt
  10634. \setleading{\textleading}%
  10635. %
  10636. \dimen0 = #1\relax
  10637. \advance\dimen0 by \voffset
  10638. \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
  10639. %
  10640. \dimen2 = \hsize
  10641. \advance\dimen2 by \normaloffset
  10642. \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
  10643. %
  10644. \internalpagesizes{#1}{\hsize}%
  10645. {\voffset}{\normaloffset}%
  10646. {\bindingoffset}{44pt}%
  10647. {\dimen0}{\dimen2}%
  10648. }}
  10649. % Set default to letter.
  10650. %
  10651. \letterpaper
  10652. % Default value of \hfuzz, for suppressing warnings about overfull hboxes.
  10653. \hfuzz = 1pt
  10654. \message{and turning on texinfo input format.}
  10655. \def^^L{\par} % remove \outer, so ^L can appear in an @comment
  10656. % DEL is a comment character, in case @c does not suffice.
  10657. \catcode`\^^? = 14
  10658. % Define macros to output various characters with catcode for normal text.
  10659. \catcode`\"=\other \def\normaldoublequote{"}
  10660. \catcode`\$=\other \def\normaldollar{$}%$ font-lock fix
  10661. \catcode`\+=\other \def\normalplus{+}
  10662. \catcode`\<=\other \def\normalless{<}
  10663. \catcode`\>=\other \def\normalgreater{>}
  10664. \catcode`\^=\other \def\normalcaret{^}
  10665. \catcode`\_=\other \def\normalunderscore{_}
  10666. \catcode`\|=\other \def\normalverticalbar{|}
  10667. \catcode`\~=\other \def\normaltilde{~}
  10668. % This macro is used to make a character print one way in \tt
  10669. % (where it can probably be output as-is), and another way in other fonts,
  10670. % where something hairier probably needs to be done.
  10671. %
  10672. % #1 is what to print if we are indeed using \tt; #2 is what to print
  10673. % otherwise. Since all the Computer Modern typewriter fonts have zero
  10674. % interword stretch (and shrink), and it is reasonable to expect all
  10675. % typewriter fonts to have this, we can check that font parameter.
  10676. %
  10677. \def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi}
  10678. % Same as above, but check for italic font. Actually this also catches
  10679. % non-italic slanted fonts since it is impossible to distinguish them from
  10680. % italic fonts. But since this is only used by $ and it uses \sl anyway
  10681. % this is not a problem.
  10682. \def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi}
  10683. % Set catcodes for Texinfo file
  10684. % Active characters for printing the wanted glyph.
  10685. % Most of these we simply print from the \tt font, but for some, we can
  10686. % use math or other variants that look better in normal text.
  10687. %
  10688. \catcode`\"=\active
  10689. \def\activedoublequote{{\tt\char34}}
  10690. \let"=\activedoublequote
  10691. \catcode`\~=\active \def\activetilde{{\tt\char126}} \let~ = \activetilde
  10692. \chardef\hatchar=`\^
  10693. \catcode`\^=\active \def\activehat{{\tt \hatchar}} \let^ = \activehat
  10694. \catcode`\_=\active
  10695. \def_{\ifusingtt\normalunderscore\_}
  10696. \def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em }
  10697. \let\realunder=_
  10698. \catcode`\|=\active \def|{{\tt\char124}}
  10699. \chardef \less=`\<
  10700. \catcode`\<=\active \def\activeless{{\tt \less}}\let< = \activeless
  10701. \chardef \gtr=`\>
  10702. \catcode`\>=\active \def\activegtr{{\tt \gtr}}\let> = \activegtr
  10703. \catcode`\+=\active \def+{{\tt \char 43}}
  10704. \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix
  10705. \catcode`\-=\active \let-=\normaldash
  10706. % used for headline/footline in the output routine, in case the page
  10707. % breaks in the middle of an @tex block.
  10708. \def\texinfochars{%
  10709. \let< = \activeless
  10710. \let> = \activegtr
  10711. \let~ = \activetilde
  10712. \let^ = \activehat
  10713. \markupsetuplqdefault \markupsetuprqdefault
  10714. \let\b = \strong
  10715. \let\i = \smartitalic
  10716. % in principle, all other definitions in \tex have to be undone too.
  10717. }
  10718. % Used sometimes to turn off (effectively) the active characters even after
  10719. % parsing them.
  10720. \def\turnoffactive{%
  10721. \normalturnoffactive
  10722. \otherbackslash
  10723. }
  10724. \catcode`\@=0
  10725. % \backslashcurfont outputs one backslash character in current font,
  10726. % as in \char`\\.
  10727. \global\chardef\backslashcurfont=`\\
  10728. \global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work
  10729. % \realbackslash is an actual character `\' with catcode other, and
  10730. % \doublebackslash is two of them (for the pdf outlines).
  10731. {\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}}
  10732. % In Texinfo, backslash is an active character; it prints the backslash
  10733. % in fixed width font.
  10734. \catcode`\\=\active % @ for escape char from now on.
  10735. % Print a typewriter backslash. For math mode, we can't simply use
  10736. % \backslashcurfont: the story here is that in math mode, the \char
  10737. % of \backslashcurfont ends up printing the roman \ from the math symbol
  10738. % font (because \char in math mode uses the \mathcode, and plain.tex
  10739. % sets \mathcode`\\="026E). Hence we use an explicit \mathchar,
  10740. % which is the decimal equivalent of "715c (class 7, e.g., use \fam;
  10741. % ignored family value; char position "5C). We can't use " for the
  10742. % usual hex value because it has already been made active.
  10743. @def@ttbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
  10744. @let@backslashchar = @ttbackslash % @backslashchar{} is for user documents.
  10745. % \rawbackslash defines an active \ to do \backslashcurfont.
  10746. % \otherbackslash defines an active \ to be a literal `\' character with
  10747. % catcode other. We switch back and forth between these.
  10748. @gdef@rawbackslash{@let\=@backslashcurfont}
  10749. @gdef@otherbackslash{@let\=@realbackslash}
  10750. % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
  10751. % the literal character `\'.
  10752. %
  10753. {@catcode`- = @active
  10754. @gdef@normalturnoffactive{%
  10755. @passthroughcharstrue
  10756. @let-=@normaldash
  10757. @let"=@normaldoublequote
  10758. @let$=@normaldollar %$ font-lock fix
  10759. @let+=@normalplus
  10760. @let<=@normalless
  10761. @let>=@normalgreater
  10762. @let^=@normalcaret
  10763. @let_=@normalunderscore
  10764. @let|=@normalverticalbar
  10765. @let~=@normaltilde
  10766. @let\=@ttbackslash
  10767. @markupsetuplqdefault
  10768. @markupsetuprqdefault
  10769. @unsepspaces
  10770. }
  10771. }
  10772. % If a .fmt file is being used, characters that might appear in a file
  10773. % name cannot be active until we have parsed the command line.
  10774. % So turn them off again, and have @fixbackslash turn them back on.
  10775. @catcode`+=@other @catcode`@_=@other
  10776. % \enablebackslashhack - allow file to begin `\input texinfo'
  10777. %
  10778. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  10779. % That is what \eatinput is for; after that, the `\' should revert to printing
  10780. % a backslash.
  10781. % If the file did not have a `\input texinfo', then it is turned off after
  10782. % the first line; otherwise the first `\' in the file would cause an error.
  10783. % This is used on the very last line of this file, texinfo.tex.
  10784. % We also use @c to call @fixbackslash, in case ends of lines are hidden.
  10785. {
  10786. @catcode`@^=7
  10787. @catcode`@^^M=13@gdef@enablebackslashhack{%
  10788. @global@let\ = @eatinput%
  10789. @catcode`@^^M=13%
  10790. @def@c{@fixbackslash@c}%
  10791. % Definition for the newline at the end of this file.
  10792. @def ^^M{@let^^M@secondlinenl}%
  10793. % Definition for a newline in the main Texinfo file.
  10794. @gdef @secondlinenl{@fixbackslash}%
  10795. % In case the first line has a whole-line command on it
  10796. @let@originalparsearg@parsearg
  10797. @def@parsearg{@fixbackslash@originalparsearg}
  10798. }}
  10799. {@catcode`@^=7 @catcode`@^^M=13%
  10800. @gdef@eatinput input texinfo#1^^M{@fixbackslash}}
  10801. % Emergency active definition of newline, in case an active newline token
  10802. % appears by mistake.
  10803. {@catcode`@^=7 @catcode13=13%
  10804. @gdef@enableemergencynewline{%
  10805. @gdef^^M{%
  10806. @par%
  10807. %<warning: active newline>@par%
  10808. }}}
  10809. @gdef@fixbackslash{%
  10810. @ifx\@eatinput @let\ = @ttbackslash @fi
  10811. @catcode13=5 % regular end of line
  10812. @enableemergencynewline
  10813. @let@c=@texinfoc
  10814. @let@parsearg@originalparsearg
  10815. % Also turn back on active characters that might appear in the input
  10816. % file name, in case not using a pre-dumped format.
  10817. @catcode`+=@active
  10818. @catcode`@_=@active
  10819. %
  10820. % If texinfo.cnf is present on the system, read it.
  10821. % Useful for site-wide @afourpaper, etc. This macro, @fixbackslash, gets
  10822. % called at the beginning of every Texinfo file. Not opening texinfo.cnf
  10823. % directly in this file, texinfo.tex, makes it possible to make a format
  10824. % file for Texinfo.
  10825. %
  10826. @openin 1 texinfo.cnf
  10827. @ifeof 1 @else @input texinfo.cnf @fi
  10828. @closein 1
  10829. }
  10830. % Say @foo, not \foo, in error messages.
  10831. @escapechar = `@@
  10832. % These (along with & and #) are made active for url-breaking, so need
  10833. % active definitions as the normal characters.
  10834. @def@normaldot{.}
  10835. @def@normalquest{?}
  10836. @def@normalslash{/}
  10837. % These look ok in all fonts, so just make them not special.
  10838. % @hashchar{} gets its own user-level command, because of #line.
  10839. @catcode`@& = @other @def@normalamp{&}
  10840. @catcode`@# = @other @def@normalhash{#}
  10841. @catcode`@% = @other @def@normalpercent{%}
  10842. @let @hashchar = @normalhash
  10843. @c Finally, make ` and ' active, so that txicodequoteundirected and
  10844. @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}. If we
  10845. @c don't make ` and ' active, @code will not get them as active chars.
  10846. @c Do this last of all since we use ` in the previous @catcode assignments.
  10847. @catcode`@'=@active
  10848. @catcode`@`=@active
  10849. @markupsetuplqdefault
  10850. @markupsetuprqdefault
  10851. @c Local variables:
  10852. @c eval: (add-hook 'before-save-hook 'time-stamp)
  10853. @c page-delimiter: "^\\\\message\\|emacs-page"
  10854. @c time-stamp-start: "def\\\\texinfoversion{"
  10855. @c time-stamp-format: "%:y-%02m-%02d.%02H"
  10856. @c time-stamp-end: "}"
  10857. @c End:
  10858. @c vim:sw=2:
  10859. @enablebackslashhack