texi2oldapi.texi 186 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001
  1. @c history and some customization sections from the texi2html manual
  2. @c (only partly edited), excised
  3. @c because the new tree-based translator is likely to obviate them.
  4. @c Doesn't format on its own, is just here (for now) for archival purposes.
  5. @c
  6. @c Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
  7. @c 2001, 2002, 2003, 2004, 2009, 2010, 2011, 2013 Free Software
  8. @c Foundation, Inc.
  9. @c
  10. @c See texinfo.etxi for copying conditions.
  11. @node Texi2HTML
  12. @appendix Texi2HTML history and relations with @command{makeinfo}
  13. In 2010 Texi2HTML was merged in GNU Texinfo. Some informations are
  14. retained here, mainly for historical purposes.
  15. @menu
  16. * Texi2HTML history:: Texi2HTML history and makeinfo.
  17. * Texi2HTML texi2any differences::
  18. * Texi2HTML changes:: History of incompatibilities.
  19. @end menu
  20. @node Texi2HTML history
  21. @appendixsec Texi2HTML history and merge in Texinfo
  22. In early 1998 @command{makeinfo} wasn't able to produce
  23. HTML output format, but people still wanted documentation in
  24. HTML. This was the birthing hour for @command{texi2html},
  25. with original author Lionel Cons. The basic purpose of
  26. @command{texi2html} was to convert Texinfo documents into HTML.
  27. Since then, HTML support in @command{makeinfo} improved, but
  28. @command{texi2html} was still stronger in some areas, including the degree to
  29. which it allows customization. After being briefly maintained by Karl
  30. Berry in 1999, Olaf Bachmann was the maintainer until 2000, adding many
  31. features. Adrian Aichner and Derek Price took over maintainance in 2001
  32. and Derek was the maintainer from 2003 to 2010, with some help from
  33. Patrice Dumas.
  34. In 2010, @command{texi2html}, then hosted
  35. at @uref{http://www.nongnu.org/texi2html/} was made
  36. compatible with @command{makeinfo}, losing the focus on HTML to become a
  37. more generic translator, and merged in
  38. @uref{http://www.gnu.org/software/texinfo/, GNU Texinfo} to
  39. replace @command{makeinfo} in C.
  40. @command{texi2html} is now installed as part of the texinfo package install,
  41. as an alias of @command{texi2any}. The @command{texi2html} documentation
  42. is also merged here in the Texinfo manual, as
  43. the @command{texi2any}/@command{makeinfo} documentation.
  44. @node Texi2HTML texi2any differences
  45. @appendixsec Differences between @command{texi2html} and @command{texi2any} invokation
  46. There are some differences between an invokation of @command{texi2any} or
  47. @command{makeinfo} and @command{texi2html}. With @command{texi2html}:
  48. @itemize @bullet
  49. @item HTML is the default output, as with @option{--html}.
  50. @item Command line is not parsed exactly like GNU getopt does. To be on the safe
  51. side:
  52. @itemize @bullet
  53. @item always use two dashes for long options.
  54. @item do not bundle short options, that is, use @code{-v -o -P} and not @code{-voP}.
  55. @end itemize
  56. @item Some options, although obsoleted are still available.
  57. @item The defaults for the HTML formatting may be slightly different.
  58. Have a look at the function @code{t2h_default_set_variables_texi2html}
  59. in @file{texi2html.pm}.
  60. @end itemize
  61. @node Texi2HTML changes
  62. @appendixsec Texi2HTML incompatibilities with previous versions
  63. @command{texi2html} has accumulated a lot of incompatibilities in previous
  64. versions, and more were added after the merge in Texinfo. Many
  65. incompatibilities were introduced in version 1.68. API changed also a
  66. lot between 1.78 and 1.80. Between 1.82 and 5.0 API changed also quite
  67. a bit, and more importantly, the whole internationalization handling was
  68. changed.
  69. @itemize @bullet
  70. @item API changes between 5.0 and later versions
  71. @itemize @bullet
  72. @item no default initialization file for latex2html. ALso don't search in
  73. directories for the latex2html initialization file, simply use the file
  74. given in argument.
  75. @item don't show menu with @option{--no-headers} as said in the makeinfo documentation.
  76. @item obsolete the @option{--iso} command line option.
  77. @item obsolete texi2html specific variables. Here is the list with the associated
  78. configuration variables that may be set instead, with @option{--set-init-variable}:
  79. @multitable {@option{--ignore-preamble-text}} {@code{IGNORE_PREAMBLE_TEXT}}
  80. @item @option{--toc-links} @tab @code{TOC_LINKS}
  81. @item @option{--short-ext} @tab @code{SHORTEXTN}
  82. @item @option{--prefix} @tab @code{PREFIX}
  83. @item @option{--short-ref} @tab @code{SHORT_REF}
  84. @item @option{--idx-sum} @tab @code{IDX_SUMMARY}
  85. @item @option{--def-table} @tab @code{DEF_TABLE}
  86. @item @option{--ignore-preamble-text} @tab @code{IGNORE_PREAMBLE_TEXT}
  87. @item @option{--html-xref-prefix} @tab @code{EXTERNAL_DIR}
  88. @item @option{--l2h} @tab @code{L2H}
  89. @item @option{--l2h-l2h} @tab @code{L2H_L2H}
  90. @item @option{--l2h-skip} @tab @code{L2H_SKIP}
  91. @item @option{--l2h-tmp} @tab @code{L2H_TMP}
  92. @item @option{--l2h-file} @tab @code{L2H_FILE}
  93. @item @option{--l2h-clean} @tab @code{L2H_CLEAN}
  94. @item @option{--use-nodes} @tab @code{USE_NODES}
  95. @item @option{--monolithic} @tab @code{MONOLITHIC}
  96. @item @option{--top-file} @tab @code{TOP_FILE}
  97. @item @option{--toc-file} @tab @code{TOC_FILE}
  98. @item @option{--frames} @tab @code{FRAMES}
  99. @item @option{--menu} @tab @code{SHOW_MENU}
  100. @item @option{--debug} @tab @code{DEBUG}
  101. @item @option{--doctype} @tab @code{DOCTYPE}
  102. @item @option{--frameset-doctype} @tab @code{FRAMESET_DOCTYPE}
  103. @item @option{--test} @tab @code{TEST}
  104. @end multitable
  105. @item remove completly $INVISIBLE_MARK, $USE_GLOSSARY, $CHECK, $EXPAND,
  106. $ENCODING, $CENTER_IMAGE, $HREF_DIR_INSTEAD_FILE, $USE_MENU_DIRECTIONS
  107. they have been obsolete, sometimes for many years.
  108. @item DATE is now set as today, DOCUMENT_ENCODING as documentencoding,
  109. extension as EXTENSION and DOCUMENT_DESCRIPTION as documentdescription.
  110. @item Don't use perl variables for configuration variables anymore. Instead,
  111. they should be set by
  112. @code{set_from_init_file('VARIABLE', value);}.
  113. For example
  114. @example
  115. $SPLIT = 'node';
  116. @end example
  117. should be replaced by
  118. @example
  119. set_from_init_file('SPLIT', 'node');
  120. @end example
  121. @item configuration variables are not in @code{Texi2HTML::THISDOC} directly
  122. anymore, but in @code{Texi2HTML::THISDOC@{'variables'@}->@{$var@}}. they
  123. should be accessed
  124. through @code{get_conf($var)}.
  125. @item remove $Texi2HTML::THISDOC@{'program_authors'@}. $Texi2HTML::THISDOC@{'program_and_version'@}
  126. holds the program and version, while $Texi2HTML::THISDOC@{'program'@} is only
  127. the program name.
  128. @end itemize
  129. @item API changes between 1.82 and 5.0:
  130. @itemize @bullet
  131. @item complex format handling API changed. $complex_format_map is replaced by
  132. a real hash %complex_format_map and the begin and end are no more
  133. evaluated.
  134. @item In the default case a gettext-like framework is now used for in document
  135. string translations. The old framework is still available by setting
  136. $I18N_PERL_HASH.
  137. @item Information that can be set by @@-commands should now be accessed
  138. through get_conf.
  139. @item $format_list_item_texi should now modify directly the @@item argument
  140. and apply the @@-command given as @@table argument. Correspondingly,
  141. some arguments of $table_item have been removed.
  142. @item Formatting of titlepage changed, and @@title, @@subtitle and @@author
  143. are now handled by $line_command
  144. @item $SEPARATED_FOOTNOTES has been replaced by $FOOTNOTESTYLE, that takes the
  145. same argument than @@footnotestyle.
  146. @item replace $LANG by $DOCUMENTLANGUAGE.
  147. @item replace $DO_CONTENTS by $CONTENTS and $DO_SCONTENTS by $SHORTCONTENTS.
  148. @item replace $TRANSLITERATE_NODE by $TRANSLITERATE_FILE_NAMES.
  149. @item replace $SECTION_NAVIGATION by $HEADERS.
  150. @item @@verbatiminclude is now a $raw command argument distinct from @@verbatim.
  151. @item @@direntry is formatted like a menu and passed down to $menu_command.
  152. @item add $NODE_FILENAMES to use node names for files associated with nodes,
  153. such that $NODE_FILES is only means creating redirection files.
  154. @item Remove the user from footer, and the corresponding USER variable and
  155. $Texi2HTML::THISDOC@{user@}.
  156. @item Don't treat _setfilename as a value set. It should be available through
  157. get_conf. Same for all the other @@-commands previously avaiable as
  158. values.
  159. @item change in class attribute for html elements:
  160. for ul to class "no-bullet" ($NO_BULLET_LIST_ATTRIBUTE). @@top
  161. and @@centerchap have now their command name as class.
  162. @@node heading class is now "node-heading", instead of "node".
  163. The whole header is in an element with class "header"
  164. (was "node" when !$HEADER_IN_TABLE).
  165. @item print_element_header is obsoleted,
  166. things should be directly done in element_heading.
  167. @item Add 'inline_attribute' for an XML attribute that should be closed at
  168. paragraph end and reopened at paragraph begin. Consequently the closing
  169. and opening of 'attribute' isn't done anymore in paragraph and
  170. preformatted.
  171. @item USE_ISO now only determines if @code{''}, @code{``} @code{---} and @code{--} are transformed
  172. into entities. t2h_default_set_iso_symbols sets or unsets USE_ISO,
  173. %things_map/%pre_map/%simple_format_simple_map_texi,
  174. $OPEN_QUOTE_SYMBOL and $CLOSE_QUOTE_SYMBOL.
  175. %iso_symbols is unused now.
  176. @item change in the normal_text function reference API, now there is an
  177. input variable true if in @@math.
  178. @item change the external_ref API, fourth argument is now the file name and
  179. add the node as an extra argument.
  180. @item rename $Texi2HTML::THISDOC@{css_lines@} as $Texi2HTML::THISDOC@{css_rule_lines@}
  181. @end itemize
  182. @item API changes between 1.78 and 1.80:
  183. @itemize @bullet
  184. @item what was done in the beginning of the $print_section
  185. function reference is now done in $print_element_header.
  186. @item there is a new argument for $normal_text.
  187. @item there is a new argument for $menu_link and $simple_menu_link, and the
  188. name argument is always set, even if there is no explicit name. The new
  189. argument is true if there really was an explicit name.
  190. @item $internal_ref and $external_ref don't change inforef to xref anymore.
  191. @item in $table_item the text is not formatted with the format command,
  192. the text_formatted argument is.
  193. @item definition index entries are now formatted with $definition_index_entry,
  194. not with $definition_category anymore.
  195. @item $printindex is called if an index appears, even if the index is not
  196. defined or there are no index entries.
  197. @item new argument (@@-command name) for $quotation and $quotation_prepend_text.
  198. @item change in the heading API. THIS_HEADER is not used anymore.
  199. New function reference, element_heading to format a node or a section
  200. heading, including navigation and label. Accordingly, print_Top and
  201. one_section don't print the element header anymore. Also it is
  202. reported if the element is a new element, is the main element and
  203. more arguments, and top element heading is always done in heading.
  204. @item print_element_header and print_navigation now return their result.
  205. @item the @code{copying} key of %Texi2HTML::THISDOC is now called
  206. @code{copying_comment}.
  207. @item TOC_LIST_ATTRIBUTE is now called NO_BULLET_LIST_ATTRIBUTE.
  208. @item TOC_LIST_STYLE is now called NO_BULLET_LIST_STYLE.
  209. @item the $unknown function reference has a new argument, the pass number.
  210. @item @option{--sec-nav} is replaced by @option{--headers}.
  211. @item @option{--Verbose} is replaced by @option{--verbose}.
  212. @item @option{--lang} is replaced by @option{--document-language}.
  213. @item @option{--separated-footnotes} is replaced by @option{--footnote-style}.
  214. @item @option{--lang} is replaced by @option{--document-language}.
  215. @item @code{&$menu_comment} is removed, @code{menu_comment} is now handled
  216. like an @@-command.
  217. @item @code{@@detailmenu} is now formatted more like @code{@@menu}, and
  218. the @code{&$menu} function reference is replaced by @code{&$menu_command}.
  219. @code{&$menu} is kept for backward compatibility. If @code{&$menu} is defined,
  220. @code{@@detailmenu} is ignored.
  221. @item the API for the formatting of menus completly changed. $simple_menu_link
  222. is removed, everything should be done in $menu_link.
  223. @item image API changed, and is unstable, so not documented.
  224. @item image file paths are not completed anymore in the default case.
  225. The previous
  226. behaviour can be restored with @code{$COMPLETE_IMAGE_PATHS} set to true.
  227. @item in %misc_command @samp{texi} is not used anymore. The value and macros
  228. are expanded as they should be unconditionnally.
  229. @item there is a new 'style' key in $complex_format_map, to be able to
  230. differentiate complex formats inheriting fonts and code_style (like
  231. @@format, @@display).
  232. @item $EXTENSION should be undef if one doesn't want an extension to be added.
  233. @item THISDOC@{'title'@} and similar are now for @@title since only one @@title
  234. should appear in the document. @@settitle is tried first to set fulltitle.
  235. @item Configuration variables are modified anymore, instead the variable
  236. value is put in $Texi2HTML::THISDOC@{'VAR'@}. This is the case for
  237. DO_CONTENTS, DO_SCONTENTS, CSS_LINES, BODYTEXT, DOCUMENT_DESCRIPTION,
  238. DOCUMENT_ENCODING, IN_ENCODING, ENCODING_NAME, OUT_ENCODING.
  239. For example, if $CSS_LINES is defined, the value is put in
  240. $Texi2HTML::THISDOC@{'CSS_LINES'@} which is used for formatting, and if
  241. $CSS_LINES is not defined, $Texi2HTML::THISDOC@{'CSS_LINES'@} is
  242. autodetected.
  243. @item When there is no section and $USE_NODES is not set don't split by node.
  244. This behaviour and the previous aren't documented, so it could change
  245. in the future.
  246. @end itemize
  247. @item API changes between 1.76 and 1.78:
  248. @itemize @bullet
  249. @item paragraph has new arguments
  250. with indentation information, added as the third argument, and
  251. other context information. The formatting linked with commands
  252. opened before the paragraph and closed after the paragraph are done
  253. in the formatting function. Similar
  254. things are done for preformatted.
  255. @item normal_text
  256. changed completely. There
  257. are much more arguments to give informations about the context, and
  258. normal_text now does more text manipulation.
  259. @item New arguments for image the alt text, the height and width,
  260. the path to working dir and the path to image file relative
  261. to working dir. More image formatting is
  262. done in the formatting function.
  263. @item New argument for empty_line.
  264. @item End of line removal is done in formatting function of definition line
  265. formatting.
  266. @item node_file_name now should only returns the node file, since the
  267. redirection file isn't used anymore. element_file_name only is used for
  268. file names, whatever NODES_FILES is.
  269. @end itemize
  270. @item changes between 1.66 and 1.68:
  271. @itemize @bullet
  272. @item When the manual is split the default is to put resulting files in
  273. a directory with name the manual file basename (previously they were left in
  274. the current directory). To avoid that, call texi2html with
  275. @option{-output .}. This has been changed to be compatible with
  276. @command{makeinfo} and also because it fits better with the cross
  277. manuals reference scheme.
  278. @item The option @option{--output} signification changed. It now
  279. has the same meaning than for @command{makeinfo}. It seems
  280. that in 1.66 it was the same than @option{-out-file}.
  281. @option{--output} new meaning allows to replace @option{-out-file} and
  282. @option{-subdir} with a unique option.
  283. More precisely @option{-out-file} forces the output to be unsplit
  284. while @option{--output} behaves differently when split (it specifies
  285. the directory
  286. where the manual files should be outputted) and unsplit (it specifies
  287. the output file). @option{-subdir} is retained for backward compatibility.
  288. If you want a backward compatibility you can use @option{-subdir}
  289. for the output directory if the document is split, and @option{-out-file}
  290. if the document isn't split. This hasn't been tested extensively though.
  291. @item Many options has been obsoleted but they are retained for
  292. backward compatibility.
  293. @item The init files are searched in new directories, however they
  294. are still searched for in the old directories for backward
  295. compatibility.
  296. @item the option @option{--glossary} doesn't do anything. Likely
  297. nothing specific is done regarding bibliographies. This has been
  298. decided because this added some semantics to the texinfo formatting
  299. language that weren't part of texinfo.
  300. It should be possible to do
  301. something similar with macros. See for example @file{glossary.texi}
  302. for glossary and @file{my-bib-macros.texi} for bibliography
  303. in the directory @file{examples}. In the web2c package there is
  304. an example of use of BibTeX, see @url{http://tug.org/texlive/devsrc/Build/source/TeX/texk/web2c/doc/} (the examples for bibliography are taken from the
  305. texinfo home page @url{http://www.gnu.org/software/texinfo/texinfo.html}).
  306. @item don't use @code{T2H_CENTER_IMAGE}. @code{@@center} should be used
  307. insead, it will give the right output for all the formats.
  308. @item If a directory creation fails the program aborts. This is much safer.
  309. @item The interface for internationalisation changed, although
  310. the previous wasn't documented a lot.
  311. @item the API described in this manual changed a lot. A important
  312. change was to use the @code{Texi2HTML::Config} names space instead of
  313. variables prefixed with @samp{T2H_} or @samp{t2h_}. To cope with
  314. the change the prefix should be removed from variables in init files.
  315. Some variables are now in @code{%Texi2HTML::THISDOC}.
  316. @item @code{@@ifinfo} regions are not expanded by default. This may lead
  317. to warnings or errors especially if the Top node is enclosed in
  318. @code{@@ifinfo}, as some node won't appear in menus. The quick fix
  319. is to call @command{texi2html} with the option @option{--ifinfo} and
  320. the right way should be to make more use of @code{@@ifnottex}.
  321. @item The code appearing before the first node is now outputted, it was
  322. ignored before. @option{--ignore-preamble-text} revert to the previous
  323. behaviour. Enclosing in @code{@@ifnothtml} would be much cleaner.
  324. @end itemize
  325. @end itemize
  326. @node texi2any Output Customization
  327. @chapter @command{texi2any} Output Customization
  328. @cartouche
  329. @quotation Warning
  330. All of this information, with the exception of command-line options
  331. and search directories (@pxref{Loading Init Files}), may become
  332. obsolete in a future Texinfo release. Right now, the ``API''
  333. described in this chapter is immature, badly designed and incomplete,
  334. so we must keep open the possibility of incompatible, possibly major,
  335. changes. Of course we try to avoid incompatible changes, but it is
  336. not a promise.
  337. @end quotation
  338. @end cartouche
  339. This chapter describes how to customize many aspects of the
  340. @command{texi2any} HTML output. Although some of the features here
  341. can technically be used with other output formats, it's not especially
  342. useful to do so, so we'll write the documentation as if HTML were the
  343. target format.
  344. @menu
  345. * Loading Init Files:: Finding and writing initialization files.
  346. * Init File Basics:: What init files can contain and do.
  347. * Output Elements:: The main unit of output documents.
  348. * Navigation Panel Customization:: Navigation buttons and more.
  349. * Customizing HTML Page Layout:: Page headers, footers, sections.
  350. * Customizing Special Elements:: The top, toc, about, etc., elements.
  351. * Customizing Output-Related Names:: File names and target names.
  352. * Customizing HTML Headings:: Sectioning commands.
  353. * Customizing Indices:: Manipulating index entries.
  354. * Customizing CSS:: CSS customization for HTML.
  355. @end menu
  356. @node Loading Init Files
  357. @section Loading Initialization Files and Search Paths
  358. @cindex Loading init files
  359. @cindex Initialization files, loading
  360. @cindex Search paths, for initialization files
  361. @pindex Config @r{init files loaded}
  362. You can write so-called @dfn{initialization files}, or @dfn{init
  363. files} for short, to modify almost every aspect of output formatting.
  364. The program loads init files named @file{Config} each time it is run.
  365. Those files are looked for in the following directories (where
  366. @var{prog} is the name of the program invoked on the command line,
  367. normally @code{makeinfo} or @code{texi2any}):
  368. @table @file
  369. @item @var{datadir}/@var{prog}/
  370. (where @var{datadir} is the system data directory specified at
  371. compile-time, e.g., @file{/usr/local/share})
  372. @item @var{sysconfdir}/@var{prog}/
  373. (likewise specified at compile time, e.g., @file{/usr/local/etc})
  374. @item ~/.@var{prog}/
  375. (where @code{~} is the current user's home directory)
  376. @item ./.@var{prog}/
  377. (under the current directory)
  378. @item ./
  379. (the current directory)
  380. @end table
  381. All @file{Config} files found are loaded, in the above order. Thus,
  382. @file{./Config} can override entries in, say,
  383. @file{/usr/local/share/makeinfo/Config}.
  384. @opindex --init-file
  385. However, the most common way to load an initialization file is with
  386. the @option{--init-file} option, explicitly specifying the file to be
  387. loaded. By default the following directories are searched, in the
  388. following order, where @var{prog} is the name of the program invoked
  389. on the command line (@command{makeinfo}, @command{texi2any}, etc.).
  390. Only the first file found is used:
  391. @enumerate
  392. @item The current directory @file{./};
  393. @item @file{./.@var{prog}/} under the current directory;
  394. @item @file{~/.@var{prog}/}
  395. where @code{~} is the current user's home directory;
  396. @item @file{@var{sysconfdir}/@var{prog}/}
  397. where @var{sysconfdir} is the system configuration directory
  398. specified at compile-time, e.g., @file{/usr/local/etc};
  399. @item @file{@var{datadir}/@var{prog}/}
  400. Where @var{datadir} is the system data directory likewise specified at
  401. compile time, e.g., @file{/usr/local/share};
  402. @item @file{./.texinfo/init/} under the current directory;
  403. @item @file{~/.texinfo/init/} under the current home directory;
  404. @item @file{@var{sysconfdir}/texinfo/init/} with @var{sysconfdir} as above;
  405. @item @file{@var{datadir}/texinfo/init/} with @var{datadir} as above.
  406. @end enumerate
  407. Additional directories may be prepended to the list with the
  408. @option{--conf-dir} option (@pxref{Invoking texi2any}).
  409. @node Init File Basics
  410. @section Init File Basics
  411. @cindex Init file basics
  412. @cindex Perl, language for init files
  413. Init files are written in Perl, and by convention have extension
  414. @file{.init} or @file{.pm}. Several init files are included in the Texinfo
  415. distribution (some are crucial components of the program), and can
  416. serve as a good model for writing your own. In particular, the
  417. @file{texi2html.pm} file is used to set all the defaults for
  418. Texinfo. Although it is large, it contains many useful examples of
  419. settings. Smaller examples include @file{utf8.pm},
  420. @file{html32.pm}, and plenty more.
  421. @menu
  422. * Init File Variables:: Configuration & other variables, function references.
  423. * Init File Namespaces:: @code{Texi2HTML::Config}, @code{Texi2HTML}, and @code{main}.
  424. * Init File Functions:: Redefining functions through references.
  425. * Setting and Getting Configuration Variables::
  426. * Init File Global Information:: Accessing document title, file name, etc.
  427. * Init File Encodings:: Overriding input and output encodings.
  428. * texi2any's Three Passes:: Macro expansion, document structure, output
  429. * Init File Calling at Different Stages:: Calling functions at various times.
  430. * Init File Formatting of Commands:: Overriding default formatting completely.
  431. * Init File General Block Commands:: Customizing usual environments.
  432. * Init File Expansion Contexts:: Normal, preformatted, string, math.
  433. * Internationalization of Strings::
  434. @end menu
  435. @node Init File Variables
  436. @subsection Init File Variables
  437. @cindex Initialization file variables
  438. @cindex Variables, in initialization files
  439. We divide the kinds of variables that can appear in initialization
  440. files into three general categories:
  441. @table @asis
  442. @item configuration variables
  443. @cindex Configuration variables
  444. Configuration variables are set and accessed through specific
  445. functions in initialization files (@pxref{@command{texi2any} Configuration
  446. Variables}).
  447. @item scalars, lists and hashes
  448. @cindex Perl variables
  449. Normal Perl variables. The order of loading of initialization files
  450. and of command-line options is important: later changes override
  451. earlier ones.
  452. @item function references
  453. @cindex Function references
  454. These allow dynamic redefinition of functions used to produce output.
  455. As such functions are defined by a reference name, we will always use
  456. the reference name in function prototypes. For the function arguments
  457. we will use @code{\@@array} to indicate a reference to an array
  458. (a.k.a.@: list, in Perl terminology) and @code{\%hash} for a reference
  459. to a hash.
  460. To illustrate these conventions, here is the prototype for the
  461. function associated with a function reference
  462. @samp{$formatting_function}:
  463. @deftypefn {Function Reference} $text formatting_function $arg1 \@@arg2
  464. @code{formatting_function} has a first argument @var{$arg1},
  465. a second argument a reference to an array @var{\@@arg2},
  466. and returns the formatted text @var{$text}.
  467. @end deftypefn
  468. To redefine this function, you would write:
  469. @example
  470. $formatting_function = \&my_formatting_function;
  471. sub my_formatting_function($ $)
  472. @{
  473. my $arg1 = shift;
  474. my $arg2 = shift;
  475. # prepare $formatted_text
  476. ...
  477. return $formatted_text;
  478. @}
  479. @end example
  480. @end table
  481. Since the program can process more than one file on the command line,
  482. you must ensure that you properly initialize the variables used during
  483. formatting. It is possible to call functions at different stages to
  484. help with that (@pxref{Init File Calling at Different Stages}).
  485. @node Init File Namespaces
  486. @subsection Init File Namespaces
  487. @cindex Init file namespaces
  488. @cindex Namespaces, for init files
  489. @cindex Perl namespaces, for init files
  490. @vindex Texi2HTML::Config @r{namespace}
  491. Initialization file are loaded from the main program via a
  492. @code{require} call in the @code{Texi2HTML::Config} namespace. This
  493. means that the namespace of the main program and the namespace of
  494. initialization files are distinct, which minimizes the chance of a
  495. name clash. The program's own variables are declared with @code{use
  496. vars}, so that it should be possible to use the @code{use strict}
  497. pragma in initialization files.
  498. @vindex Texi2HTML @r{namespace}
  499. @vindex main @r{namespace}
  500. To avoid accidentally altering the variables in the @code{main}
  501. namespace, all the global variables which could be of use in init
  502. files are available in the @code{Texi2HTML} namespace.
  503. The functions of the main program, however, are still in the
  504. @code{main} namespace.
  505. @node Init File Functions
  506. @subsection Init File Functions
  507. @cindex Init file functions
  508. @cindex Functions, overriding in init files
  509. @cindex Overriding functions in init files
  510. To redefine a function you must replace the appropriate function
  511. reference with a reference to your function: write your function, give
  512. it a name you ensure is unique in the @code{Texi2HTML::Config}
  513. namespace, and then override the value of the function reference with
  514. your own. When another function from the main program (or anywhere
  515. else) calls the reference, your function will be used.
  516. For example, the function reference to the function called when
  517. handling an anchor is called @code{$anchor}. Thus, to override the
  518. corresponding function you could write:
  519. @example
  520. # override the function reference:
  521. $anchor = \&my_anchor_fn;
  522. # define the function to do the work:
  523. sub my_anchor_fn @{
  524. # process arguments, return an html anchor
  525. @}
  526. @end example
  527. @node Setting and Getting Configuration Variables
  528. @subsection Setting and Getting Configuration Variables
  529. @cindex Configuration variables, setting and getting
  530. The basic operations on configuration variables are to set and
  531. retrieve their values.
  532. To set the value of a configuration variable from an initialization file,
  533. you should use @code{set_from_init_file}:
  534. @defun set_from_init_file ($variable_name, $variable_value)
  535. @var{$variable_name} is a string containing the name of the variable
  536. you want to set, and @var{$variable_value} is the value to which you
  537. want to set it. @var{$variable_value} may be @samp{undef}.
  538. @end defun
  539. For example,
  540. @example
  541. set_from_init_file('documentlanguage', 'fr');
  542. @end example
  543. @noindent overrides the @code{@@documentlanguage} from the
  544. document. It would be overridden by @option{--document-language} on
  545. the command line.
  546. Another example:
  547. @example
  548. set_from_init_file('SPLIT', 'chapter');
  549. @end example
  550. @noindent overrides the default splitting of the document. It would be
  551. overridden by @option{--split} on the command line.
  552. A final example:
  553. @example
  554. set_from_init_file('NO_CSS', 1);
  555. @end example
  556. @noindent overrides the default value for @code{NO_CSS}. It would be
  557. overridden by @code{--set-init-variable NO_CSS=1} on the command line.
  558. To get the value of a variable, the function is @code{get_conf}:
  559. @defun get_conf ($variable_name)
  560. @var{$variable_name} is the name of the variable; its value (possibly
  561. @code{undef}) is returned.
  562. @end defun
  563. For example:
  564. @example
  565. if (get_conf('footnotestyle') eq 'separate') @{ ... @}
  566. @end example
  567. For the configuration variables associated with @@-commands, see
  568. @ref{Configuration Variables for @@-Commands}. For the configuration
  569. variables associated with command line options, see @ref{Configuration
  570. Variables and Options}.
  571. @node Init File Global Information
  572. @subsection Init File Global Information
  573. @c @ignore
  574. @c FIXME those are still undocumented
  575. @c 'split_level'
  576. @c 'variable_levels' 'variables'
  577. @c do_about
  578. @c 'FH' 'state' 'format_from_command_line'
  579. @c command_stack
  580. @c line_nr
  581. @c %htmlxref
  582. @c %hyphenation
  583. @c @end ignore
  584. @cindex Init files, and global information
  585. @cindex Global information, in init files
  586. Much global information about the document is available as the basis
  587. for customization in init files.
  588. @menu
  589. * Title String Variables:: @code{@@author}, @code{@@title}, etc.
  590. * Command Line String Variables:: Input and output file names, etc.
  591. * Global Document String Variables:: @code{@@copying}, CSS, TOC, etc.
  592. * Index String Variables:: @code{defindex}, @code{@@synindex}, etc.
  593. * Init File Flag Values:: @code{@@set} values.
  594. * Program String Customization:: For the About element and footers.
  595. @end menu
  596. @node Title String Variables
  597. @subsubsection Title String Variables
  598. @cindex Title string variables
  599. For title-related @@-commands, such as @code{@@title},
  600. @code{@@titlefont}, and @code{@@author}, a variety of information is
  601. available, with diverse formatting.
  602. @code{@@author} and @code{@@subtitle} are multiline title-related
  603. commands, since they may appear more than once. Multiline
  604. title-related commands are associated with strings that are
  605. constructed by concatenating all the command occurences. They are
  606. also associated with arrays, and the name of the arrays is constructed
  607. by appending a @samp{s} to the command name, as in @code{authors}.
  608. Some information is also deduced from the title commands:
  609. @dfn{simpletitle} reflects @code{@@settitle} vs.\
  610. @code{@@shorttitlepage}, and @dfn{fulltitle} is constructed by trying
  611. all the title-related commands, including @code{@@top} and
  612. @code{@@titlefont}, in the top element.
  613. @vindex Texi2HTML::THISDOC
  614. The information associated with @code{@@top}, @code{@@title},
  615. @code{@@settitle}, @code{@@shorttitlepage}, @code{@@author},
  616. @code{@@subtitle}, @code{simpletitle} and @code{fulltitle} are
  617. associated with the following keys in the @code{%Texi2HTML::THISDOC}
  618. hash, where @var{command} is the title @@-command:
  619. @table @code
  620. @item @var{command}_texi
  621. The original Texinfo code.
  622. @item @var{command}
  623. The corresponding text formatted.
  624. @item @var{command}_no_texi
  625. The text formatted as simple plain text.
  626. @item @var{command}_simple_format
  627. The text formatted as a string without formatting elements
  628. (@pxref{Init File Expansion Contexts}).
  629. @item @var{command}_line_nr
  630. An opaque structure corresponding with the line where the @@-comand
  631. appeared. Not available for @code{@@titlefont}, multiline
  632. title-related commands and derived information.
  633. @end table
  634. For multiline commands, the following array references are associated
  635. with the following keys in the @code{%Texi2HTML::THISDOC} hash, where
  636. @var{command} is the title @@-command:
  637. @table @code
  638. @item @var{command}s
  639. Reference to an array containing all lines set by
  640. @code{@@@var{command}}, formatted.
  641. @item @var{command}s_texi
  642. Reference to an array containing all the original Texinfo lines.
  643. @item @var{command}s_line_nr
  644. Reference to an array of opaque structures corresponding with the
  645. line where the @@-command lines appeared.
  646. @end table
  647. @node Command Line String Variables
  648. @subsubsection Command Line String Variables
  649. @cindex Command-line string variables
  650. These entries in the @code{%Texi2HTML::THISDOC} hash are related to
  651. the command-line processing:
  652. @table @code
  653. @item destination_directory
  654. Destination directory for the output files.
  655. @item file_base_name
  656. Base name of the Texinfo input file.
  657. @item filename
  658. This is a reference to a hash that holds the filenames for special
  659. elements. These files may not be used in certain cases, for example
  660. the @code{toc} element file name may not be relevant if table of
  661. contents is not output separately. The keys are:
  662. @table @code
  663. @item doc
  664. If not split, the document file; if split, the top element file.
  665. @item top
  666. Top element file name.
  667. @item toc
  668. Table of contents element file name.
  669. @item stoc
  670. Overview (a.k.a.@: short table of contents) element file name.
  671. @item about
  672. About element file name.
  673. @item foot
  674. Footnotes element file name.
  675. @item frame
  676. Main frame file.
  677. @item toc_frame
  678. Table of contents frame file name.
  679. @end table
  680. @item input_directory
  681. Path to the directory containing the Texinfo input file being processed.
  682. @item input_file_name
  683. Name of the Texinfo input file as given on the command line.
  684. @item input_file_number
  685. Number of the Texinfo input file from the command line which is
  686. currently being processed.
  687. @item program
  688. The name of the command generating the output.
  689. @item program_and_version
  690. The name and version of the command generating the output.
  691. @item program_homepage
  692. Home page of the command generating the output.
  693. @end table
  694. @node Global Document String Variables
  695. @subsubsection Global Document String Variables
  696. @cindex Global document strings
  697. These entries in the @code{%Texi2HTML::THISDOC} hash provide other
  698. global document information.
  699. @table @code
  700. @item copying_comment
  701. Text appearing in @code{@@copying} with all the Texinfo commands
  702. put into comments (@pxref{copying,,@code{@@copying}}).
  703. @item css_import_lines
  704. Reference to an array containing the @code{@@import} lines of
  705. @acronym{CSS} files (@pxref{HTML CSS}).
  706. @item css_rule_lines
  707. Reference to an array containing the normal lines of @acronym{CSS}
  708. files.
  709. @item dircategory_texi
  710. The Texinfo @code{@@dircategory} argument (@pxref{Installing Dir Entries}).
  711. @item dircategory
  712. The formatted @code{@@dircategory} argument.
  713. @item inline_contents
  714. A reference to a hash containing two keys, one for each type of table
  715. of contents: @code{contents} and @code{shortcontents}. Each
  716. associated value is a reference to an array containg the lines
  717. resulting from formatting the respective type of table of contents,
  718. including a heading and a reference.
  719. @item stoc_file
  720. The file name of the Overview (short table of contents).
  721. @item toc_file
  722. The file name of the table of contents.
  723. @end table
  724. @node Index String Variables
  725. @subsubsection Index String Variables
  726. @cindex Index strings
  727. These entries in the @code{%Texi2HTML::THISDOC} hash provide other
  728. index-related information.
  729. @table @code
  730. @item defindex
  731. @itemx defcodeindex
  732. References to arrays holding the corresponding @@-command
  733. arguments.
  734. @item merged_index
  735. Reference to a hash whose keys are the index names merged in
  736. the values.
  737. @item index_letters_array
  738. @itemx index_entries_array
  739. @itemx index_entries_region_array
  740. @itemx index_entries
  741. @itemx indices_numbers
  742. @itemx indices
  743. References to hashes holding information about the index entries
  744. and whole indices.
  745. @item synindex
  746. @itemx syncodeindex
  747. Reference to arrays containing array references with two elements,
  748. the two arguments of @code{@@synindex}
  749. (@pxref{synindex,,@code{@@synindex}}).
  750. @end table
  751. @node Init File Flag Values
  752. @subsubsection Init File Flag Values
  753. @cindex Init file flag values
  754. @cindex Flag values, in init files
  755. @cindex @code{@@set} values, in init files
  756. @vindex %main::value
  757. Flags defined with @code{@@set} (@pxref{set value})
  758. may be accessed through the @code{%main::value} hash. The key is the
  759. flag name, and the value is the flag value.
  760. @node Program String Customization
  761. @subsubsection Program String Customization
  762. @cindex Program string customization
  763. @cindex Customization of program string
  764. @vindex PROGRAM_NAME_IN_FOOTER
  765. The following function reference may be used to construct a string
  766. advertising the program used to generate the output. It may be used
  767. in the @code{About} element, and in the footers if
  768. @code{PROGRAM_NAME_IN_FOOTER} is set.
  769. @deftypefn {Function Reference} $program_string_formatted program_string
  770. This function reference should return the formatted program
  771. string.
  772. @end deftypefn
  773. @node Init File Encodings
  774. @subsection Init File Encodings
  775. @cindex Init file encodings
  776. @cindex Encodings, in init files
  777. There are four encoding-related variables, which are autodetected
  778. if not set:
  779. @vtable @code
  780. @item documentencoding
  781. This configuration variable may be set, overriding any encoding
  782. set by @code{@@documentencoding} (@pxref{documentencoding,,
  783. @code{@@documentencoding}}).
  784. @item IN_ENCODING
  785. The encoding of the Texinfo files may be set independently with this
  786. variable. If not, then when @code{documentencoding} is set,
  787. @code{IN_ENCODING} is also set if the encoding is supported by Perl.
  788. @item ENCODING_NAME
  789. The encoding advertised in output files. If not set, the value of
  790. this variable is based on the other ENCODING values, and if they are
  791. all undefined, the variable @code{DEFAULT_ENCODING} is used.
  792. @item OUT_ENCODING
  793. The encoding of the output files. If not set, the value of
  794. @code{ENCODING_NAME} or @code{IN_ENCODING} is used if one of these
  795. variables is set.
  796. @end vtable
  797. In general, the @code{documentencoding} and @code{IN_ENCODING} are set
  798. to the appropriate values with no need to override.
  799. @code{OUT_ENCODING} is set according to @code{ENCODING_NAME}. To
  800. force a given encoding for the output, it's best to set
  801. @code{ENCODING_NAME}. The default output encoding for Info is ASCII,
  802. and for other formats is UTF-8.
  803. The values for the encoding related variables are set in the default
  804. @code{init_out} function reference (@pxref{Output Initialization}).
  805. @node texi2any's Three Passes
  806. @subsection @code{texi2any}'s Three Passes: Macro Expansion, Document Structure, Output
  807. @cindex @code{texi2any's} three passes
  808. @cindex Passes, of @code{texi2any}
  809. @cindex Three passes, of @code{texi2any}
  810. @command{texi2any} operates in three passes to transform the original
  811. input to the final output. In pass@tie{}0, the @code{@@macro} calls
  812. are expanded; in pass@tie{}1, the document structure is gathered; and
  813. in pass@tie{}2 the result is output. In most cases this organization
  814. does not matter, as output customization is almost always done in
  815. pass@tie{}2. Only if you want to do something during an earlier pass
  816. do you need to consider this, as explained below.
  817. After the Texinfo input file has been parsed, some information is
  818. available which can be used to modify some variables and prepare for
  819. the output. For example, even such basic things as the document
  820. language, the document encoding, values set with @code{@@set} or
  821. @code{@@setfilename}, etc., cannot be known before the Texinfo
  822. parsing.
  823. @anchor{Output Initialization}
  824. @cindex Output initialization
  825. @cindex Initialization of output
  826. The following function reference may be redefined to be called after
  827. Texinfo processing and before document generation, i.e., for output
  828. initialization:
  829. @deffn {Function Reference} init_out
  830. This function performs the initialization of variables and other
  831. tasks before document output.
  832. @end deffn
  833. By default, the hashes @code{%BUTTONS_NAME} (@pxref{Navigation Panel
  834. Button Specification}) and @code{%BUTTONS_GOTO} (@pxref{About Element
  835. Customization}) are initialized. The initialization of these
  836. variables depends on the document language. Similarly, the encoding
  837. variables are set based on the information now available (@pxref{Init
  838. File Encodings}). When generating HTML, aditionally, the
  839. @code{%NAVIGATION_TEXT} hash is initialized.
  840. To perform the default initializations, which are almost surely
  841. desired, and also add more code, the best way is to save the default
  842. function reference and then call it in your new function, like this:
  843. @example
  844. my $default_init_out = $init_out;
  845. $init_out = \&my_init_out;
  846. sub my_init_out()
  847. @{
  848. &$default_init_out();
  849. $NAVIGATION_TEXT@{'NodeForward'@} = ' > ';
  850. @}
  851. @end example
  852. @anchor{Output Finalization}
  853. @cindex Output finalization
  854. @cindex Finalization of output
  855. At the other end of things, if you want to do some clean-up after the
  856. document was generated (write at the end of the output files, issue
  857. messages, @dots{}), the following function reference may be overridden:
  858. @deffn {Function Reference} finish_out
  859. This function is called after the document generation.
  860. @end deffn
  861. The default is to do nothing.
  862. These function references are mostly redundant with the handlers described
  863. in the next section (@pxref{Init File Calling at Different Stages}).
  864. @node Init File Calling at Different Stages
  865. @subsection Init File Calling at Different Stages
  866. @cindex Init file calling functions at different stages
  867. @cindex Calling functions at different stages
  868. @cindex Functions, calling at different stages
  869. Arbitrary user-defined functions may be called between the different
  870. Texinfo parsing and outputting passes (see previous section). This
  871. could be used, for example, to initialize variables before collecting
  872. the @@-commands and their text, expanding them between the collecting
  873. and expansion phase and doing clean-up after the expansion pass.
  874. There are five places for user defined functions, each associated with
  875. an array. The function references in each array are called one after
  876. another. The arrays correspond with the different stages:
  877. @vtable @code
  878. @item @@command_handler_setup
  879. Called before anything is done, including collecting the output file
  880. names. The input file names' directories are available.
  881. @item @@command_handler_init
  882. Called as soon as the input file names are known. It may be at
  883. different moments: before processing anything, right after
  884. @code{@@setfilename}, or at the end of pass@tie{}0 (after
  885. @code{@@macro} and @code{@@include} expansions). At that time the
  886. information available is essentially just the input file names.
  887. @item @@command_handler_names
  888. Called right after pass@tie{}1, the main input collection. At that
  889. time all the special @@-commands have been collected as explained
  890. above, but no output has been produced, and the element (node and
  891. section) names have not been processed.
  892. @item @@command_handler_process
  893. Called after the element names have been processed, but
  894. before the main output initialization.
  895. @item @@command_handler_output
  896. Called right before the main output processing, so that more
  897. information is available, such as the title (@pxref{Init File Global
  898. Information}).
  899. @item @@command_handler_finish
  900. Called after output generation is finished.
  901. @end vtable
  902. Because these are arrays, you should use @code{push} to add your
  903. functions to them, like this (a real example from the @LaTeX{}2HTML
  904. support):
  905. @example
  906. push (@@command_handler_init,
  907. \&Texi2HTML::LaTeX2HTML::init);
  908. push (@@command_handler_process,
  909. \&Texi2HTML::LaTeX2HTML::latex2html);
  910. push (@@command_handler_finish,
  911. \&Texi2HTML::LaTeX2HTML::finish);
  912. @end example
  913. For a real-life example, see the @LaTeX{}2HTML support.
  914. @node Init File Formatting of Commands
  915. @subsection Init File Formatting of Commands
  916. @cindex Init file formatting of commands
  917. @cindex Formatting of commands, in init file
  918. @cindex Commands, custom formatting
  919. It is possible to bypass completely the normal formatting of
  920. @@-commands with braces and the block commands of ``raw'' input such
  921. as @code{@@html} and @code{@@tex} (@pxref{Raw Formatter Commands}).
  922. In these cases the @@-commands and the text within are passed to a
  923. user-defined function early, right after the document structure
  924. determination of pass@tie{}1 (@pxref{texi2any's Three Passes}).
  925. Another user-defined function is called during the output expansion
  926. phase.
  927. @vindex %command_handler
  928. These user-defined functions are specified as values in the
  929. @code{%command_handler} hash, with the key being the command to
  930. override. The associated value is itself a hash reference, whose keys
  931. can be @code{'init'} for the function reference called during the
  932. first pass, and @code{'expand'} during the expansion pass.
  933. Here is an example for an @@-command with braces, @code{math}, used
  934. for in the @LaTeX{}toHTML support:
  935. @example
  936. $command_handler@{'math'@} =
  937. @{ 'init' => \&Texi2HTML::LaTeX2HTML::to_latex,
  938. 'expand' => \&Texi2HTML::LaTeX2HTML::do_tex
  939. @};
  940. @end example
  941. @cindex Raw region, overriding formatting of
  942. Handling a raw region @@-command is the same:
  943. @example
  944. $command_handler@{'tex'@} =
  945. @{ 'init' => \&Texi2HTML::LaTeX2HTML::to_latex,
  946. 'expand' => \&Texi2HTML::LaTeX2HTML::do_tex
  947. @};
  948. @end example
  949. These function references are called as follows, respectively:
  950. @deftypefn {Function Reference} $status @
  951. $command_handler@{'$command'@}->@{'init'@} $command $text $count
  952. @var{$command} is the @@-command name, @var{$text} is the text
  953. appearing within the @@-command, and @var{$count} counts how many
  954. times this @@-command has appeared. @var{$status} is a boolean to return,
  955. true if the collection was succesful. If it is false, the @@-command
  956. and the text are discarded.
  957. @end deftypefn
  958. @deftypefn {Function Reference} $result @
  959. $command_handler@{'$command'@}->@{'expand'@} $command $count \%state $text
  960. @var{$command} is the @@-command name, @var{$count} counts how many
  961. times this @@-command has appeared, and @var{\%state} is a hash
  962. reference with detailed context information; @var{$text} should be
  963. empty. @var{$result} is the expanded resulting text.
  964. @end deftypefn
  965. @node Init File General Block Commands
  966. @subsection Init File General Block Commands
  967. @cindex Init file general block commands
  968. @cindex General block commands, in init files
  969. @cindex Block commands, in init files
  970. A @dfn{general block @@-command} is any @@-command which is paired
  971. with an @code{@@end @var{cmdname}}, with the exception of those
  972. @@-commands selecting whether input is processed (such as
  973. @code{@@ignore} and @code{@@ifhtml}) and ``raw'' @@-commands (such as
  974. @code{@@verbatim} and @code{@@html}).
  975. @deftypefn {Function Reference} $line begin_format_texi $command $line \%state
  976. @var{$command} is the format command, @var{$line} is the rest of the
  977. line following the @@-command, and @var{\%state} is a hash reference
  978. with detailed context information. The function can modify
  979. @code{$line} and return something else.
  980. @end deftypefn
  981. By default, this is used to keep track of multitable nesting, and so
  982. it is linked with multitable formating.
  983. @c oldapi @pxref{Multitable Formatting}
  984. @node Init File Expansion Contexts
  985. @subsection Init File Expansion Contexts: Normal, Preformatted, String, Math
  986. @cindex Init file expansion contexts
  987. @cindex Expansion contexts, for init files
  988. @cindex Contexts for expansion in init files
  989. There are four expansion contexts of interest:
  990. @table @emph
  991. @item normal context
  992. @cindex Normal expansion context
  993. Paragraphs, index entries, tables, @enddots{}
  994. @item preformatted context
  995. @cindex Preformatted expansion context
  996. When spaces between words are kept. For example, within the
  997. @code{@@display} (@pxref{display,, @code{@@display}}) and
  998. @code{@@example} environments (@pxref{example,, @code{@@example}}), and
  999. in menu comments. The preformatted regions
  1000. are usually rendered using @code{<pre>} elements in HTML.
  1001. @c oldapi (@pxref{Menu formatting})
  1002. @item string context
  1003. @cindex String expansion context
  1004. When rendering strings without formatting elements, for example in
  1005. comments (@pxref{Comments}) and titles. We have two string contexts,
  1006. one that produces plain text, and a second that allows for limited
  1007. formatting, typically without any element when producing HTML or XML,
  1008. so the value can be used in an attribute.
  1009. @item math context
  1010. @cindex Math expansion context
  1011. Math (@pxref{math,, @code{@@math}}).
  1012. @end table
  1013. @node Internationalization of Strings
  1014. @subsection Internationalization of Strings in the Output Document
  1015. @cindex I18n
  1016. @cindex Internationalization of strings in the output document
  1017. @cindex Output documentation, internationalization of
  1018. @vindex documentlanguage @r{configuration variable}
  1019. @command{texi2any} writes some fixed strings in the generated document
  1020. at various places: for cross references, in page footers, on the help
  1021. page, alternate text for images, and so on. The string chosen depends
  1022. on the value of the configuration variable @code{documentlanguage} at
  1023. the time of the string being output (@pxref{documentlanguage}, for the
  1024. Texinfo command interface).
  1025. @pindex libintl-perl @r{Gettext implementation}
  1026. The Gettext framework is used for those strings (@pxref{Top,,,
  1027. gettext, Gettext}). The @code{libintl-perl} package is used as
  1028. the @code{gettext} implementation; more specifically, the pure Perl
  1029. implementation is used, so Texinfo can support consistent behavior
  1030. across all platforms and installations, which would not otherwise be
  1031. possible. @code{libintl-perl} is included in the Texinfo distribution
  1032. and always installed, to be sure that it is available if needed. It
  1033. is also possible to use the system @code{gettext}; currently decided
  1034. at build-time).
  1035. @vindex texinfo_document @r{Gettext domain}
  1036. The Gettext domain @samp{texinfo_document} is used for the strings,
  1037. and the subroutine @code{gdt} is used for translated
  1038. strings:
  1039. @defun gdt ($string, \%variables_hash, \%state)
  1040. @var{$string} is the string to be translated, @var{\%variables_hash}
  1041. is a hash reference holding the variable parts of the translated
  1042. string, and @var{\%state} is a hash reference with detailed context
  1043. information.
  1044. @end defun
  1045. @cindex Perl format strings for translation
  1046. Translated strings are written as Texinfo, and may include
  1047. @@-commands. In translated strings, the varying parts of the string
  1048. are not usually denoted by @code{%s} and the like, but by
  1049. @samp{@{arg_name@}}. (This convention is common for @code{gettext} in
  1050. Perl and is fully supported in GNU Gettext; @pxref{perl-format,, Perl
  1051. Format Strings, gettext, GNU Gettext}.) For example, in the
  1052. following, @samp{@{section@}} will be replaced by the section name:
  1053. @example
  1054. see @{section@}
  1055. @end example
  1056. These Perl-style brace format strings are used for two reasons: first,
  1057. changing the order of @code{printf} arguments is only available since
  1058. Perl@tie{}5.8.0; second, and more importantly, the order of the
  1059. argument is unpredictable, since @@-command expansion may lead to
  1060. different orders depending on the output format. The expansion of
  1061. a translation string is done like this:
  1062. @enumerate
  1063. @item First, the string is translated. The locale
  1064. is @var{@@documentlanguage}@code{.}@var{@@documentencoding}.
  1065. @cindex @code{us-ascii} encoding, and translations
  1066. If the @var{@@documentlanguage} has the form @var{ll_CC}, @var{ll_CC}
  1067. is tried first, and then @var{ll}. If that does not exist, and the
  1068. encoding is not @code{us-ascii}, then @code{us-ascii} is tried. The
  1069. idea is that if there is a @code{us-ascii} encoding, it means that all
  1070. the characters in the charset may be expressed as @@-commands. For
  1071. example, there is a @code{fr.us-ascii} locale that can accommodate any
  1072. encoding, since all the Latin@tie{}1 characters have associated
  1073. @@-commands. On the other hand, Japanese has only a translation
  1074. @code{ja.utf-8}, since there are no @@-commands for Japanese
  1075. characters.
  1076. @item Next, the args in string are protected. For example,
  1077. @samp{@{ arg_name @}} becomes@*
  1078. @samp{@@internal_translation_open_brace@{@} arg_name@*
  1079. @@internal_translation_close_brace@{@}}
  1080. (this part is skipped if there is nothing to expand).
  1081. @item Next, the string is expanded as Texinfo.
  1082. @samp{@@internal_translation_open_brace@{@}} expands to @samp{@{} and
  1083. @samp{@@internal_translation_close_brace@{@}} expands to @samp{@}},
  1084. such that in the end one still gets @samp{@{arg_name@}} within an
  1085. expanded string (this part is skipped if there is nothing to expand).
  1086. @item Finally, the arguments are substituted; for
  1087. example, @samp{@{arg_name@}} is replace by the corresponding actual
  1088. argument.
  1089. @end enumerate
  1090. @vindex duplicate @r{in @code{%state} hash}
  1091. In the following example, @samp{@{date@}}, @samp{@{program_homepage@}}
  1092. and @samp{@{program@}} are the arguments of the string. Since they
  1093. are used in @code{@@uref}, their order is not predictable. The
  1094. @samp{@{'duplicate'=>1@}} means that the document state should be used
  1095. when expanding the string. @samp{@{date@}},
  1096. @samp{@{program_homepage@}} and @samp{@{program@}} are substituted
  1097. after the expansion, which means that they should already be
  1098. acceptable output:
  1099. @example
  1100. gdt('Generated on @@emph@{@{date@}@} using
  1101. @@uref@{@{program_homepage@}, @@emph@{@{program@}@}@}.',
  1102. @{
  1103. 'date' => $date,
  1104. 'program_homepage' => $Texi2HTML::THISDOC@{'program_homepage'@},
  1105. 'program' => $Texi2HTML::THISDOC@{'program_and_version'@} @},
  1106. @{'duplicate'=>1,
  1107. @});
  1108. @end example
  1109. This approach is admittedly a bit complicated. Its usefulness is that
  1110. it supports having translations available in different encodings for
  1111. encodings which can be covered by @@-commands, and also specifying how
  1112. the formatting for some commands is done, independently of the output
  1113. format---yet still be language dependent. For example, a
  1114. @samp{@@pxref} translation string may be:
  1115. @example
  1116. see @{node_file_href@} section `@{section@}\' in @@cite@{@{book@}@}
  1117. @end example
  1118. @noindent
  1119. which allows specifying a string independently of the output format,
  1120. but with rich formatting that may be translated appropriately in many
  1121. languages.
  1122. @vindex keep_texi @r{in @code{%state} hash}
  1123. Expansion can be prevented by setting the key @code{keep_texi} in the
  1124. @code{state} hash.
  1125. When an @code{@@documentlanguage} line appears in the document and the
  1126. language was not set on the command line, it is convenient for the
  1127. translations to redefine some variables based on the new language.
  1128. Therefore, Texinfo has a function reference which is called each time
  1129. @code{@@documentlanguage} is encountered:
  1130. @deffn {Function Reference} $translate_names
  1131. Called each time @code{@@documentlanguage} is encountered, if the
  1132. language was not set on the command line. It should be used to
  1133. retranslate strings based on the new language.
  1134. @end deffn
  1135. @node Output Elements
  1136. @section Output Elements
  1137. @cindex Output elements
  1138. @cindex Elements, main unit of output documents
  1139. We will call the main unit of output documents an @dfn{element}. An
  1140. element's association with output files is determined by the split
  1141. options (@pxref{Splitting Output}). This section describes precisely
  1142. how these output elements work, with details for customization.
  1143. @menu
  1144. * Defined: Output Elements Defined.
  1145. * Labels: Output Element Labels.
  1146. * Lines: Output Element Lines.
  1147. @end menu
  1148. @node Output Elements Defined
  1149. @subsection Output Elements Defined
  1150. @cindex Output elements, defined
  1151. The output elements are:
  1152. @table @emph
  1153. @item Normal elements
  1154. @cindex Normal elements
  1155. These are normal sections and nodes. Usually a node is associated
  1156. with a following sectioning command, while a sectioning command is
  1157. associated with a previous node; they both together make up the
  1158. element. Either the node or the sectioning command is considered to
  1159. be the main element component, depending on the values of the
  1160. configuration variables @code{USE_NODES} and @code{USE_SECTIONS}
  1161. (@pxref{@command{texi2any} Configuration Variables}).
  1162. For example, when generating Info, the nodes are the elements; when
  1163. generating Docbook, sectioning commands are the main element
  1164. component; and when generating HTML, either case may happen
  1165. (@pxref{Two Paths}).
  1166. @item Top element
  1167. @cindex Top element
  1168. The top element is the highest element in the document structure. If
  1169. the document has an @code{@@top} section (@pxref{makeinfo top}), it is
  1170. the element associated with that section; otherwise, it is the element
  1171. associated with the document's @code{@@node Top} (@pxref{The Top
  1172. Node}). If there is no @code{@@node Top}, the first element in the
  1173. document is the top element.
  1174. The top element may end up formatted differently from normal elements
  1175. if there is an @code{@@top} section or the @code{@@node Top} is not
  1176. associated with a sectioning command.
  1177. @item Miscellaneous elements
  1178. @cindex Table of contents, output element
  1179. @cindex Short table of contents, output element
  1180. @cindex Overview, output element
  1181. @cindex Footnotes, output element
  1182. @cindex About page, output element
  1183. The remaining elements are associated with different files if the
  1184. document is split, and also if @code{MONOLITHIC} is not set. There
  1185. are four such miscellaneous elements:
  1186. @enumerate
  1187. @item Table of contents
  1188. @item Short table of contents, also called Overview
  1189. @item Footnotes page
  1190. @item About page
  1191. @end enumerate
  1192. More details:
  1193. @itemize
  1194. @item The @emph{Table of contents} should only be formatted if
  1195. @code{@@contents} is present in the document.
  1196. @item Similarly the @emph{Overview} should only appear if
  1197. @code{@@shortcontents} or @code{@@summarycontents} is present.
  1198. @item The configuration variables @code{contents} and
  1199. @code{shortcontents} may be set to trigger the output of the
  1200. respective elements.
  1201. @item If @code{INLINECONTENTS} is set, the @emph{Table of contents} and
  1202. @emph{Overview} elements are directly included within the document,
  1203. rather than as separate pages (@pxref{Contents and Overview Elements
  1204. Customization}).
  1205. @item When generating HTML, the @emph{Footnotes page} should only
  1206. be present if the footnotes appear on a separate page (@pxref{Footnote
  1207. Styles}). However, a footnote element is present if the document is
  1208. not split.
  1209. @item The @emph{About page} shouldn't be present for documents
  1210. consisting of only one sectioning element, or for monolithic documents
  1211. without navigation information.
  1212. @end itemize
  1213. @end table
  1214. It is common not to have anything but normal elements, especially in
  1215. case of monolithic output. It is usually with HTML output that
  1216. special elements may be present.
  1217. The main component of elements is sections if @code{USE_SECTIONS} is
  1218. set or @code{USE_NODES} is set to 0; conversely, the main component is
  1219. nodes if @code{USE_NODES} is set or @code{USE_SECTIONS} is 0. If both
  1220. configuration variables are undefined, heuristics are used, influenced
  1221. by the presence of nodes or sectioning elements in the document: if
  1222. there are no nodes, sectioning elements are preferred and vice versa.
  1223. When sections are the main components of elements, ``isolated'' nodes
  1224. not directly associated with a sectioning command are associated with
  1225. the following sectioning command, while sectioning commands without
  1226. nodes constitute an element. Conversely, when nodes are the main
  1227. components of elements, isolated sections not associated with nodes
  1228. are associated with the previous node, and isolated nodes are
  1229. elements.
  1230. @node Output Element Labels
  1231. @subsection Output Element Labels
  1232. @cindex Output element labels
  1233. @cindex Element labels
  1234. A variety of data items, called @dfn{element labels}, are associated
  1235. with elements. They may be used in the formatting functions, and/or
  1236. associated with a button (@pxref{Navigation Panel Button Specification}).
  1237. Each element label has a name and a reference to the element they
  1238. represent, when such an element exists. The element is either a
  1239. global element (for example, the first element) or relative to the
  1240. current element (for example, the next element). Such relative
  1241. elements are determined with respect to the document structure defined
  1242. by the section structuring commands (@code{@@chapter},
  1243. @code{@@unnumbered}@dots{}) or by the nodes if the node pointers are
  1244. specified on @code{@@node} lines or in menus, as explained above
  1245. (@pxref{Two Paths}).
  1246. Here is the list of element labels:
  1247. @table @emph
  1248. @item @samp{@ }
  1249. An empty button.
  1250. @item Top
  1251. Top element. The associated name is @code{$TOP_HEADING} if that variable is
  1252. defined. This variable is not set by default.
  1253. @item About
  1254. About (help) page.
  1255. @item Contents
  1256. Table of contents.
  1257. @item Overview
  1258. Overview: short table of contents.
  1259. @item Footnotes
  1260. Corresponds to the @code{Footnotes} element (@pxref{Output Elements
  1261. Defined}).
  1262. @item Index
  1263. The first chapter with @code{@@printindex}. The associated name is
  1264. @code{$INDEX_CHAPTER}, if the variable is set. This variable is not
  1265. set by default.
  1266. @item This
  1267. The current element.
  1268. @item Forward
  1269. Next element in reading order.
  1270. @item First
  1271. First element in reading order.
  1272. @item Last
  1273. Last element in reading order.
  1274. @item Back
  1275. Previous element in reading order.
  1276. @item FastForward
  1277. Next chapter.
  1278. @item FastBack
  1279. Beginning of this chapter, or previous chapter if the element is a chapter.
  1280. @item Next
  1281. Next section at the same level.
  1282. @item Prev
  1283. Previous section at the same level.
  1284. @item Up
  1285. Up section.
  1286. @item SectionNext
  1287. Next in section reading order.
  1288. @item SectionPrev
  1289. Previous in section reading order.
  1290. @item SectionUp
  1291. Up in section reading order.
  1292. @item NodeNext
  1293. Next node.
  1294. @item NodeForward
  1295. Next node in node reading order.
  1296. @item NodeBack
  1297. Previous node in node reading order.
  1298. @item NodePrev
  1299. Previous node.
  1300. @item NodeUp
  1301. Up node.
  1302. @end table
  1303. The element labels may also be accessed when formatting elements.
  1304. Four hashes are available, with their keys being the elements items,
  1305. and their values as follows:
  1306. @vtable @code
  1307. @item %Texi2HTML::NAME
  1308. The formatted element name.
  1309. @item %Texi2HTML::HREF
  1310. The element hypertext reference.
  1311. @item %Texi2HTML::NODE
  1312. The element node name.
  1313. @item %Texi2HTML::NO_TEXI
  1314. The element name after removal of texi commands.
  1315. @end vtable
  1316. For example, @code{$Texi2HTML::NAME@{'Back'@}} is the name of the
  1317. previous element in reading order.
  1318. @node Output Element Lines
  1319. @subsection Output Element Lines
  1320. @cindex Output elements lines
  1321. @cindex Formatted lines, of output elements
  1322. The following array references holds formatted lines relating to
  1323. various output elements.
  1324. @vtable @code
  1325. @item $Texi2HTML::OVERVIEW
  1326. Lines of the short table of contents. @xref{Contents and Overview
  1327. Elements Customization}.
  1328. @item $Texi2HTML::THIS_SECTION
  1329. Lines of the current element.
  1330. @item $Texi2HTML::TITLEPAGE
  1331. The title page formatted. @xref{HTML Title Page Customization}.
  1332. @item $Texi2HTML::TOC_LINES
  1333. Lines of table of contents. @xref{Contents and Overview Elements
  1334. Customization}.
  1335. @end vtable
  1336. @node Navigation Panel Customization
  1337. @section Navigation Panel Customization
  1338. @cindex Customization, of navigation panel
  1339. @cindex Navigation panel, customization of
  1340. The @dfn{navigation panel} is the line of links (and labels) that
  1341. typically appears at the top of each node, so that users can easily
  1342. get to the next node, the table of contents, and so on. It can be
  1343. customized extensively.
  1344. Considerable customization can done with straightforward variable
  1345. assignments, especially special arrays. The configuration variables
  1346. @code{VERTICAL_HEAD_NAVIGATION}, @code{ICONS}, @code{HEADERS},
  1347. @code{HEADER_IN_TABLE}, @code{USE_ACCESSKEY} and @code{USE_REL_REV}
  1348. may be used to change the the navigation panel formatting.
  1349. @xref{@command{texi2any} Configuration Variables}.
  1350. In the unusual case that this isn't enough, it is also possible to
  1351. redefine the function doing the navigation panel formatting.
  1352. @menu
  1353. * Buttons: Navigation Panel Button Specification.
  1354. * Functions: Navigation Panel Formatting Functions.
  1355. @end menu
  1356. @node Navigation Panel Button Specification
  1357. @subsection Navigation Panel Button Specification
  1358. @cindex Navigation panel button specification
  1359. @cindex Button specification, navigation panel
  1360. Several arrays and hashes enable precise control over the navigation
  1361. panel buttons and their display. The following arrays determine the
  1362. buttons present in the various navigation panels:
  1363. @vtable @code
  1364. @item @@SECTION_BUTTONS
  1365. Specifies the navigation panel buttons present at the beginning of
  1366. sectioning elements. If the output is split at nodes or sections,
  1367. they are also used at the page footer, and in the case of section
  1368. navigation being enabled, at the page header.
  1369. @item @@SECTION_FOOTER_BUTTONS
  1370. @itemx @@NODE_FOOTER_BUTTONS
  1371. These arrays specify the navigation panel buttons present in the page
  1372. footer when the output is split at sections or nodes, respectively.
  1373. @vindex WORDS_IN_PAGE
  1374. If @code{WORDS_IN_PAGE} is set and the output is split at nodes, these
  1375. buttons are only included if the sectioning element text has more than
  1376. @code{WORDS_IN_PAGE} words. The word counting is only approximate and
  1377. includes punctuation marks, html elements, numbers. The default is to
  1378. include the buttons for elements larger than 300 words.
  1379. @item @@CHAPTER_BUTTONS
  1380. Specifies the buttons appearing at the page footer if split at
  1381. chapters, and at the page header if split at chapters and there is no
  1382. section navigation.
  1383. @item @@MISC_BUTTONS
  1384. Specifies the buttons appearing at the beginning of special elements
  1385. and, if the output is split, at the end of such elements.
  1386. @item @@LINKS_BUTTONS
  1387. Used for @code{<link>} elements if they are output in the headers.
  1388. @item @@TOP_BUTTONS
  1389. Specifies the buttons used in the top element (@pxref{Output Elements
  1390. Defined}).
  1391. @end vtable
  1392. Each array specifies which buttons are included, and how they are
  1393. displayed. Each array element is associated with a button of the
  1394. navigation panel from left to right. The meaning of the array element
  1395. values is the following:
  1396. @table @emph
  1397. @item function reference
  1398. The function is called with one boolean argument, true if the
  1399. navigation panel should be vertical. Should return the formatted
  1400. button text.
  1401. @item scalar reference
  1402. The scalar value is printed. @xref{Output Element Labels}, for some
  1403. scalars that may be useful here.
  1404. @item array reference
  1405. Here, the first array element should be a reference to a text string
  1406. and the second element an element label. A link to the element
  1407. associated with the element label with the given text is generated.
  1408. For example, if the button array element is
  1409. @example
  1410. [ 'Next', \$Texi2HTML::NODE@{Next@} ]
  1411. @end example
  1412. @noindent
  1413. Then the button will be a link to the next section with text
  1414. @code{$Texi2HTML::NODE@{Next@}}.
  1415. @item element label
  1416. @vindex %NAVIGATION_TEXT
  1417. @vindex init_out
  1418. If icons are not used, the button is a link to the corresponding
  1419. element whose text is defined by the value associated with the element
  1420. label in the @code{%NAVIGATION_TEXT} hash, surrounded by @samp{[} and
  1421. @samp{]}. If the element label is @samp{ }, the @samp{[} and @samp{]}
  1422. are omitted. The elements of the @code{%NAVIGATION_TEXT} hash are
  1423. defined dynamically, in the @code{init_out} function reference
  1424. (@pxref{Output Initialization}).
  1425. @vindex %ACTIVE_ICONS
  1426. @vindex %BUTTONS_NAME
  1427. @vindex %PASSIVE_ICONS
  1428. @vindex %NAVIGATION_TEXT
  1429. @cindex Icons, in navigation buttons
  1430. If icons are used, the button is an image whose file is determined by
  1431. the value associated with the element label in the
  1432. @code{%ACTIVE_ICONS} hash if the link leads to an element, or in the
  1433. @code{%PASSIVE_ICONS} hash if there is no element to link to. If
  1434. there is a link to the element, the icon links to that element. The
  1435. button name and button description are given as HTML attributes to
  1436. have a textual description of the icon. The corresponding strings are
  1437. in @code{%BUTTONS_NAME} for the button name and
  1438. @code{%NAVIGATION_TEXT} for the description.
  1439. @end table
  1440. @vindex %BUTTONS_ACCESSKEY
  1441. @cindex @code{accesskey} navigation
  1442. If the configuration variable @code{USE_ACCESSKEY} is set, the
  1443. @code{accesskey} attribute is used in navigation. The
  1444. @code{%BUTTONS_ACCESSKEY} hash is then used for the @code{accesskey}
  1445. attributes.
  1446. @vindex %BUTTONS_REL@r{, for navigation}
  1447. @cindex @code{rel} navigation
  1448. Similarly, if the @code{USE_REL_REV} configuration variable is set,
  1449. the @code{rel} attribute is used in navigation. In that case the
  1450. @code{%BUTTONS_REL} hash is used for the @code{rel} attribute.
  1451. @node Navigation Panel Formatting Functions
  1452. @subsection Navigation Panel Formatting Functions
  1453. @cindex Navigation panel formatting functions
  1454. @cindex Formatting functions, for navigation panel
  1455. In the unusual event that your needs are not met by changing the
  1456. navigation buttons (see the previous section), you can completely
  1457. control the formatting of navigation panels by redefining function
  1458. references.
  1459. The overall display of navigation panels is controlled via this
  1460. function reference, @code{print_navigation}:
  1461. @deftypefn {Function Reference} $navigation_text print_navigation @
  1462. \@@buttons $vertical
  1463. @var{\@@buttons} is an array reference holding the specification of
  1464. the buttons for that navigation panel. @var{$vertical} is true if the
  1465. navigation panel should be vertical. Returns the formatted navigation
  1466. panel in @var{$navigation_text}.
  1467. @end deftypefn
  1468. The function reference @code{button_formatting} does the formatting of
  1469. one button:
  1470. @deftypefn {Function Reference} $formatted_button button_formatting @
  1471. $button $vertical
  1472. @var{$button} holds the specification of the button as explained
  1473. above. @var{$vertical} is true if the navigation panel should be
  1474. vertical. Returns the formatted result in @var{$formatted_button}.
  1475. @end deftypefn
  1476. By default, the function associated with @code{$print_head_navigation}
  1477. formats the navigation panel for the page header.
  1478. @deftypefn {Function Reference} $page_head print_head_navigation @
  1479. $filehandle \@@buttons $first_in_page $previous_is_top \%element
  1480. @itemize @bullet
  1481. @item @var{$filehandle} is the opened filehandle the function should
  1482. write to, if defined. If not defined the function should return the
  1483. formatted page header as a string.
  1484. @item @var{\@@buttons} is an array reference holding the specification
  1485. of the buttons for the navigation panel.
  1486. @item @var{$first_in_page} should be set if this is the first navigation
  1487. panel in the page.
  1488. @item @var{$previous_is_top} is true if the previous element is the
  1489. top element.
  1490. @item @var{\%element} is a hash reference with information about
  1491. the element.
  1492. @end itemize
  1493. @end deftypefn
  1494. Similarly, the function associated with @code{$print_foot_navigation}
  1495. formats the navigation panel for the page footer.
  1496. @deffn {Function Reference} print_foot_navigation @
  1497. $filehandle \@@buttons $rule $print_navigation_panel \%element $maybe_in_page
  1498. @itemize @bullet
  1499. @item @var{$filehandle}, @var{\@@buttons}, and @var{\%element} are as above.
  1500. @item @var{$rule} is a rule that may be used to separate the navigation panel
  1501. from the preceding text.
  1502. @item @var{$print_navigation_panel} is a boolean specifying
  1503. whether the navigation panel itself should be printed.
  1504. @item @var{$maybe_in_page} is set if the present footer is between
  1505. regular elements and the top, or between regular elements and special
  1506. elements, that is, not at the end of a file.
  1507. @end itemize
  1508. @end deffn
  1509. @node Customizing HTML Page Layout
  1510. @section Customizing HTML Page Layout
  1511. @command{texi2any} provides for customization of the HTML page
  1512. headers, footers, and the section layout in between. (These are
  1513. unrelated to the headings and ``footings'' produced in @TeX{} output;
  1514. @pxref{Headings,, Page Headings}.)
  1515. @menu
  1516. * Headers: Customizing HTML Page Headers.
  1517. * Sections: Customizing HTML Section Layout.
  1518. * Footers: Customizing HTML Page Footers.
  1519. @end menu
  1520. @node Customizing HTML Page Headers
  1521. @subsection Customizing HTML Page Headers
  1522. @cindex Customizing HTML page headers
  1523. @cindex Headers, customizing for HTML
  1524. The following three function references give full control over the
  1525. page header formatting done at the top of each HTML output file. The
  1526. @code{$print_page_head} function is called for all pages. After that,
  1527. the @code{$print_chapter_header} function is called if the output is
  1528. split at chapters, or the @code{$print_section_header} function if the
  1529. split at sections.
  1530. @deftypefn {Function Reference} print_page_head $filehandle
  1531. @cindex @code{<body>} tag, outputting
  1532. @var{$filehandle} is the opened filehandle to which the function
  1533. should write. This function should print the page header, in HTML,
  1534. including the @code{<body>} element.
  1535. @end deftypefn
  1536. @deffn {Function Reference} print_chapter_header $filehandle \%element
  1537. @var{$filehandle} is the opened filehandle to which the function
  1538. should write. @var{\%element} is a hash reference with information
  1539. about the element. This function is called if the output is split
  1540. at chapters, after @code{$print_page_head}.
  1541. @end deffn
  1542. @deffn {Function Reference} print_section_header $filehandle \%element
  1543. @var{$filehandle} and @var{\%element} are as above. This function is
  1544. called if the output is split at sections, after
  1545. @code{$print_page_head}.
  1546. @end deffn
  1547. @vindex $EXTRA_HEAD
  1548. @vindex $AFTER_BODY_OPEN
  1549. @cindex @code{<head>} block, adding to
  1550. You can define the variable @code{$EXTRA_HEAD} to add text within the
  1551. @code{<head>} HTML element. Similarly, the value of
  1552. @code{$AFTER_BODY_OPEN} is added just after @code{<body>} is output.
  1553. These variables are empty by default.
  1554. @vindex BODYTEXT@r{, in customization}
  1555. @cindex @code{<body>} tag, attributes of
  1556. The @code{<body>} element attributes may be set by defining the
  1557. configuration variable @code{BODYTEXT}.
  1558. @vindex ENCODING_NAME
  1559. @cindex Encoding, in HTML output
  1560. By default, the encoding name from @code{ENCODING_NAME} is used. If
  1561. this variable is not defined, it is automatically determined
  1562. (@pxref{Init File Encodings}).
  1563. @vindex $DATE_IN_HEADER
  1564. @cindex Date, in header
  1565. A date is output in the header if @code{$DATE_IN_HEADER} is set.
  1566. @cindex Document description, in HTML output
  1567. The description from @code{@@documentdescription} (or a value set as a
  1568. configuration variable) is used in the header
  1569. (@pxref{documentdescription}).
  1570. @vindex @@LINKS_BUTTONS@r{, in customization}
  1571. @vindex %BUTTONS_REL@r{, in customization}
  1572. @code{<link>} elements are used in the header if @code{$USE_LINKS} is
  1573. set, in which case @code{@@LINKS_BUTTONS} determines which links are
  1574. used and @code{%BUTTONS_REL} determines the link type associated with
  1575. the @code{rel} attribute. @xref{Navigation Panel Button
  1576. Specification}.
  1577. @node Customizing HTML Section Layout
  1578. @subsection Customizing HTML Section Layout
  1579. @cindex Customizing HTML section layout
  1580. @cindex Section layout, customizing for HTML
  1581. The following function references are used for the formatting of
  1582. sections in HTML output:
  1583. @deffn {Function Reference} print_section $filehandle @
  1584. $first_in_page $previous_is_top \%element
  1585. @table @var
  1586. @item $filehandle
  1587. The opened filehandle to which the function should write.
  1588. @item $first_in_page
  1589. True if this section is the first section in the page.
  1590. @item $previous_is_top
  1591. True if this section is the section following the top section.
  1592. @item \%element
  1593. A hash reference with information about the element.
  1594. @end table
  1595. The function should print the current section contents.
  1596. @end deffn
  1597. @deffn {Function Reference} end_section $filehandle @
  1598. $last_element_or_before_top \%element
  1599. @var{$filehandle} and @var{\%element} are as above.
  1600. @var{$last_element_or_before_top} is true if this section precedes the
  1601. top element or is the last one in page, or before the special
  1602. elements.
  1603. @end deffn
  1604. @node Customizing HTML Page Footers
  1605. @subsection Customizing HTML Page Footers
  1606. @cindex Customizing HTML page footers
  1607. @cindex Footer, customizing for HTML
  1608. The following function references give full control over the page
  1609. footer formatting done at the bottom of each HTML output file. The
  1610. @code{$print_chapter_footer} function is called if the output is split
  1611. at chapters, or the @code{$print_section_footer} footer is called if
  1612. split at sections. After that, the @code{$print_page_foot} function
  1613. is called.
  1614. @deffn {Function Reference} print_page_foot $filehandle
  1615. @cindex @code{</body>} tag, outputting
  1616. @var{$filehandle} is the opened filehandle to which the function
  1617. should write. This function should print the page footer, including
  1618. the @code{</body>} element.
  1619. @end deffn
  1620. @deffn {Function Reference} print_chapter_footer $filehandle \%element
  1621. @var{$filehandle} is the opened filehandle to which the function
  1622. should write. @var{\%element} is a reference to a hash with
  1623. information about the element. This function is called if the
  1624. output is split at chapters, before @code{$print_page_foot}.
  1625. @end deffn
  1626. @deffn {Function Reference} print_section_footer $filehandle \%element
  1627. @var{$filehandle} and @var{\%element} are as above.
  1628. This function is called if the output is split at sections, before
  1629. @code{$print_page_foot}.
  1630. @end deffn
  1631. @vindex $PRE_BODY_CLOSE
  1632. You can define the variable @code{$PRE_BODY_CLOSE} to add text just
  1633. before the HTML @code{</body>} element. Nothing is added by default.
  1634. @vindex $PROGRAM_NAME_IN_FOOTER
  1635. If @code{$PROGRAM_NAME_IN_FOOTER} is set, the date and name of the
  1636. program that generated the output are output in the footer.
  1637. @node Customizing Special Elements
  1638. @section Customizing Special Elements
  1639. Various function references allow you to customize both the content
  1640. and layout of the HTML output of the special elements (@pxref{Output
  1641. Elements Defined}).
  1642. @menu
  1643. * Content: Customizing Content of Special Elements.
  1644. * Layout: Customizing Layout of Special Elements.
  1645. @end menu
  1646. @node Customizing Content of Special Elements
  1647. @subsection Customizing Content of Special Elements
  1648. @cindex Customizing special elements content
  1649. @cindex Special elements content, customizing
  1650. @cindex Content of special elements, customizing
  1651. The label for the special elements (@pxref{Output Elements Defined}),
  1652. except for the top element, is formatted according to the function
  1653. reference @code{$misc_element_label}:
  1654. @deftypefn {Function Reference} $misc_element_label misc_element_label @
  1655. $identifier $page_name
  1656. @var{$identifier} is the identifier associated with the special
  1657. element. @var{$page_name} is the special element name. The function
  1658. should return a label that can be used for references to the special
  1659. element.
  1660. @end deftypefn
  1661. The following sections describe the details for the special elements
  1662. other than footnotes, which are formatted when the @code{@@footnote}
  1663. command is expanded.
  1664. @c oldapi (@pxref{Customizing HTML Footnotes}).
  1665. @menu
  1666. * Top Element Customization::
  1667. * Contents and Overview Elements Customization::
  1668. * About Element Customization::
  1669. * HTML Title Page Customization::
  1670. @end menu
  1671. @node Top Element Customization
  1672. @subsubsection Top Element Customization
  1673. @cindex Customization of top element
  1674. @cindex Top element, customizing
  1675. The top element formatting is controlled by three functions which also
  1676. controls the layout of the top element page or section. The associated
  1677. function references are:
  1678. @deffn {Function Reference} print_Top_header $filehandle $begin_page
  1679. @var{$filehandle} is the opened filehandle to which the function
  1680. should write. @var{$begin_page} is true if the element is the first
  1681. in a page. This function should begin the top element. At the time
  1682. this function is called, the top element text has not been parsed.
  1683. @end deffn
  1684. @deffn {Function Reference} print_Top $filehandle $has_top_heading \%element
  1685. @var{$filehandle} is the opened filehandle to which the function
  1686. should write. @var{$has_top_heading} is true if there is a
  1687. @code{@@heading} command or @code{@@titlefont} command appearing in
  1688. the top element text. @var{\%element} is a hash reference with
  1689. information about the element. This function should be used to format
  1690. the top element text and navigation panel.
  1691. @end deffn
  1692. @deffn {Function Reference} print_Top_footer $filehandle $end_page \%element
  1693. @var{$filehandle} and @var{\%element} are as above. @var{$end_page}
  1694. is true if the element is the last in a page. This function should
  1695. end the top element.
  1696. @end deffn
  1697. @node Contents and Overview Elements Customization
  1698. @subsubsection Contents and Overview Elements Customization
  1699. @cindex Customization of tables of contents elements
  1700. @cindex Contents, customizing elements
  1701. @cindex Short table of contents element, customizing
  1702. @cindex Overview element, customizing
  1703. To begin with, the table of contents and short table of contents can
  1704. be made to appear at either the beginning (the default) or end of the
  1705. document.
  1706. @vindex INLINE_CONTENTS
  1707. By default, the configuration variable
  1708. @code{INLINE_CONTENTS} is set, specifying that the tables of contents
  1709. are not output as separate elements but instead where the
  1710. corresponding @@-command, for example @code{@@contents}, is set. This
  1711. behavior is consistent with @command{texi2dvi}.
  1712. If @code{INLINE_CONTENTS} is not set, the tables of contents are
  1713. output in separate elements, either at the end of the document if the
  1714. output is unsplit or in separate files if not. This makes sense
  1715. when menus are used for navigation.
  1716. @txicmdindex @@setcontentsaftertitlepage @r{and HTML output}
  1717. If @code{@@setcontentsaftertitlepage} appears in the document, even if
  1718. @code{INLINE_CONTENTS} is set, the tables of contents are merged into
  1719. the title material, which in turn is not output by default;
  1720. @pxref{HTML Title Page Customization}.
  1721. Next, the following variables allow for some useful control of the
  1722. formatting of table of contents and short table of contents:
  1723. @vtable @code
  1724. @item $BEFORE_TOC_LINES
  1725. Inserted before the table of contents text.
  1726. @item $AFTER_TOC_LINES
  1727. Inserted after the table of contents text.
  1728. @item $BEFORE_OVERVIEW
  1729. Inserted before the short table of contents text.
  1730. @item $AFTER_OVERVIEW
  1731. Inserted after the short table of contents text.
  1732. @item $NO_BULLET_LIST_STYLE
  1733. Expected to contain the CSS style used for the list style when there
  1734. is no bullet.
  1735. @item $NO_BULLET_LIST_CLASS
  1736. Used for the class associated with the $NO_BULLET_LIST_STYLE CSS
  1737. style.
  1738. @item $NO_BULLET_LIST_ATTRIBUTE
  1739. Used as attribute text for the list element when there is no bullet.
  1740. It is used in the tables of contents if they are formatted as a list.
  1741. @end vtable
  1742. Finally, the following function reference provides even more control
  1743. over the table of contents and short table of contents formatting
  1744. reference:
  1745. @deffn {Function Reference} toc_body \@@elements
  1746. @var{\@@elements} is an array reference containing information about
  1747. all the elements of the document. Each entry of this array is a hash
  1748. reference, useful keys of which are as follows:
  1749. @table @code
  1750. @item top
  1751. True if the element is the top element.
  1752. @item index_page
  1753. True if the element is an index page added because of index splitting.
  1754. @item toc_level
  1755. Level of the element in the table of contents: the highest level is 1
  1756. for the top element and for chapters, appendices, etc., 2 for
  1757. sections, unnumbered sections, etc., and so on.
  1758. @item tocid
  1759. Label to be used for references linking to this element within the
  1760. table of contents.
  1761. @item file
  1762. The file containing the element, part of the link if the output is
  1763. split.
  1764. @item text
  1765. Text of the element, with section number,
  1766. @item name
  1767. Text of the element, without section number.
  1768. @end table
  1769. @vindex $Texi2HTML::TOC_LINES@r{, in customization}
  1770. @vindex $Texi2HTML::OVERVIEW@r{, in customization}
  1771. This function doesn't return anything. Instead, it should fill the
  1772. array corresponding to the @code{$Texi2HTML::TOC_LINES} and
  1773. @code{$Texi2HTML::OVERVIEW} references with the text for the
  1774. respective tables of contents. @xref{Output Element Lines}.
  1775. @end deffn
  1776. By default, @code{$toc_body} calls two specialized function
  1777. references, one for the contents and the other for the short contents.
  1778. @deftypefn {Function Reference} \@@contents_lines contents @
  1779. \@@elements $contents_file
  1780. @var{\@@elements} is an array reference as above.
  1781. @var{$contents_file} is the name of the file containing the table of
  1782. contents. This function should return the formatted table of contents
  1783. lines.
  1784. @end deftypefn
  1785. @deftypefn {Function Reference} \@@shortcontents_lines shortcontents @
  1786. \@@elements $shortcontents_file
  1787. @var{\@@elements} is an array reference as above.
  1788. @var{$shortcontents_file} is the name of the file containing the table
  1789. of contents. This function should return the formatted overview
  1790. (short table of contents) lines.
  1791. @end deftypefn
  1792. Another function reference is used to add a heading and a reference,
  1793. to be used with @code{INLINE_CONTENTS} or merged into the title
  1794. material. Its output is not used when the tables of contents are
  1795. separate elements.
  1796. @deftypefn {Function Reference} \@@inline_contents_lines inline_contents @
  1797. $filehandle $command \%element \@@elements
  1798. Return a reference to an array holding the lines containing the
  1799. contents, heading and reference. @var{$filehandle} is a reference to
  1800. the currently opened file if the function is called because a
  1801. @code{@@contents} or @code{@@shortcontents} command was encountered,
  1802. and @code{undef} otherwise. @var{$command} is either @samp{contents}
  1803. or @samp{shortcontents}. @var{\%element} is a reference to a hash
  1804. holding information about the element where the contents appeared.
  1805. Relevant keys are:
  1806. @table @code
  1807. @item target
  1808. The identifier associated with the table of contents, used
  1809. to link to the table of contents.
  1810. @item id
  1811. The identifier associated with the element, used to do labels.
  1812. Usually but not necessarily the same as @code{target}.
  1813. @item file
  1814. The file name containing the table of contents.
  1815. @end table
  1816. @var{\@@elements} is an array reference as above.
  1817. @end deftypefn
  1818. @node About Element Customization
  1819. @subsubsection About Element Customization
  1820. @cindex Customization of about element
  1821. @cindex About element, customizing
  1822. The default About element has an explanation of the buttons used in
  1823. the document (controlled by @code{@@SECTION_BUTTONS};
  1824. @pxref{Navigation Panel Button Specification}) and an example showing
  1825. the button targets. The formatting of this text may be influenced by
  1826. the following:
  1827. @table @code
  1828. @item $PRE_ABOUT
  1829. @itemx $AFTER_ABOUT
  1830. @vindex $PRE_ABOUT
  1831. @vindex $AFTER_ABOUT
  1832. Each of these variables may be a scalar or a function reference. If a
  1833. scalar, the value is used. If a function reference, it is called and
  1834. the returned text is used. The text is added before or after the main
  1835. About text, respectively.
  1836. @item %BUTTONS_GOTO
  1837. @vindex %BUTTONS_GOTO
  1838. The keys of this hash are element labels (@pxref{Output Element
  1839. Labels}), and the values are the text associated with each element
  1840. label in the About text. By default, the elements of the hash are
  1841. defined dynamically in the @code{init_out} function reference
  1842. (@pxref{Output Initialization}).
  1843. @item %BUTTONS_EXAMPLE
  1844. @vindex %BUTTONS_EXAMPLE
  1845. Like @code{%BUTTONS_GOTO}, except the values are the text from the
  1846. About example, typically a section number.
  1847. @end table
  1848. If the above is not enough and you want to control exactly the
  1849. formatting of the about text, the following function reference may be
  1850. overridden:
  1851. @deftypefn {Function Reference} $about_text about_body
  1852. This function returns the about text.
  1853. @end deftypefn
  1854. @node HTML Title Page Customization
  1855. @subsubsection HTML Title Page Customization
  1856. @vindex $Texi2HTML::TITLEPAGE
  1857. The HTML title page is first formatted using the text appearing in the
  1858. @code{@@titlepage} section, and put in the
  1859. @code{$Texi2HTML::TITLEPAGE} array reference (@pxref{Output Element
  1860. Lines}). More formatting can be done using the following function
  1861. reference:
  1862. @deffn {Function Reference} titlepage \@@titlepage_lines @
  1863. $text $comment $simple_text
  1864. @var{\@@titlepage_lines} is an array containing the Texinfo lines in
  1865. @code{@@titlepage}. @var{$text} is the text appearing in
  1866. @code{@@titlepage}, formatted. @var{$comment} is the text with
  1867. Texinfo markup removed, thus should be simple plain text.
  1868. @var{$simple_text} is the text formatted in a string context with
  1869. minimal formatting but no elements. This function should complete
  1870. @code{$Texi2HTML::TITLEPAGE}.
  1871. @end deffn
  1872. By default, this function outputs the title if there is no title page,
  1873. and adds the table of contents and short table of contents if they are
  1874. to be output and @code{@@setcontentsaftertitlepage} or
  1875. @code{@@setshortcontentsaftertitlepage} appear in the document
  1876. (@pxref{Contents and Overview Elements Customization}).
  1877. @vindex USE_TITLEPAGE_FOR_TITLE
  1878. @vindex SHOW_TITLE
  1879. The resulting title page output is used in the document if
  1880. @code{USE_TITLEPAGE_FOR_TITLE} and @code{SHOW_TITLE} are set.
  1881. @node Customizing Layout of Special Elements
  1882. @subsection Customizing Layout of Special Elements
  1883. @cindex Customizing special elements layout
  1884. @cindex Special elements layout, customizing
  1885. @cindex Layout of special elements, customizing
  1886. The formatting of each of the special elements is controlled by a
  1887. function, as listed in the following table:
  1888. @ftable @code
  1889. @item print_Top
  1890. @item print_Top_header
  1891. @item print_Top_footer
  1892. Formatting of the top element. It is also used for the formatting of
  1893. the top element text (@pxref{Top Element Customization}).
  1894. @item print_Toc
  1895. Formatting of the table of contents element.
  1896. @item print_Overview
  1897. Formatting of the short table of contents element.
  1898. @item print_About
  1899. Formatting of about (help) element.
  1900. @item print_Footnotes
  1901. Formatting of the footnote elements.
  1902. @end ftable
  1903. @findex print_misc
  1904. @findex print_misc_header
  1905. @findex print_misc_footer
  1906. In the default case, @code{$print_Top} calls @code{$print_Top_header}
  1907. for the header and @code{$print_Top_footer} for the footer of top
  1908. element. All the other functions call @code{$print_misc} which in
  1909. turn calls @code{$print_misc_header} for the headers and
  1910. @code{$print_misc_footer} for the footers.
  1911. @node Customizing Output-Related Names
  1912. @section Customizing Output-Related Names
  1913. It is possible to control both output file names and target
  1914. identifiers in detail.
  1915. @menu
  1916. * File: Customizing Output File Names.
  1917. * Target: Customizing Output Target Names.
  1918. @end menu
  1919. @node Customizing Output File Names
  1920. @subsection Customizing Output File Names
  1921. @cindex Customizing output file names
  1922. @cindex Output file names, customizing
  1923. @vindex PREFIX
  1924. @vindex SUBDIR
  1925. @vindex EXTENSION
  1926. It is possible to specify the output file names with more control than
  1927. merely the command line option @option{--output} (@pxref{Invoking
  1928. texi2any}). The @code{PREFIX} configuration variable overrides the
  1929. base name of the file given by @code{@@setfilename} or the file name
  1930. and should not contain any directory components. To alter
  1931. intermediate directories, use the @code{SUBDIR} configuration
  1932. variable. Finally, The extension may also be overriden by the
  1933. configuration variable @code{EXTENSION}. This variable should be
  1934. @code{undef} if no extension is to be added.
  1935. @vindex TOP_FILE
  1936. @vindex TOC_FILE
  1937. Furthermore, the configuration variables @code{TOP_FILE} and
  1938. @code{TOC_FILE} override the output file name for the top and contents
  1939. elements.
  1940. @vindex NODE_FILES
  1941. Two function references enable further customization. The first,
  1942. @code{node_file_name}, is especially useful when @code{NODE_FILES} is
  1943. true; it is used to customize the node file name.
  1944. @deftypefn {Function Reference} $node_file node_file_name \%node $type
  1945. @var{\%node} is a hash reference with the following interesting keys
  1946. (there are many others): the string @code{texi}, for the Texinfo node
  1947. name, and the boolean @code{with_section}, true if associated with a
  1948. section. @var{$type} is @code{top} if the node is the top element.
  1949. The function should return the node file name (@var{$node_file}).
  1950. @end deftypefn
  1951. The other function reference, @code{element_file_name}, is used to
  1952. customize the file names associated with each element, and the name of
  1953. the file associated with the special elements (@pxref{Output Elements
  1954. Defined}).
  1955. @deftypefn {Function Reference} $file element_file_name @
  1956. \%element $type $txi_file_name
  1957. @var{\%element} is undefined for the special elements (@pxref{Output
  1958. Elements Defined}), Otherwise, it is a hash reference with the
  1959. following interesting keys (there are many others):
  1960. @table @code
  1961. @item texi
  1962. The Texinfo element name.
  1963. @item number
  1964. The number associated with a section.
  1965. @item doc_nr
  1966. A number incremented whenever a new file should begin, based on how the
  1967. document is split (@pxref{Splitting Output}).
  1968. @item text
  1969. The element text.
  1970. @item name
  1971. The element text without section number.
  1972. @end table
  1973. @var{$type} is empty for normal elements. For the top element it is
  1974. @samp{top}; for the table of contents it is @samp{toc}; for the
  1975. overview it is @samp{stoc}; for footnotes it is @samp{foot}; and for
  1976. the about element it is @samp{about}.
  1977. @vindex FRAMES@r{, customizing output names of}
  1978. If frames are used, due to the @code{FRAMES} configuration variable,
  1979. the function reference is also called for @samp{frame}, the frame file
  1980. name, and @samp{toc_frame}, the table of contents frame file name.
  1981. @var{$txi_file_name} is the basename of the Texinfo manual.
  1982. The function should return the file name for the element (@var{$file}).
  1983. @end deftypefn
  1984. @node Customizing Output Target Names
  1985. @subsection Customizing Output Target Names
  1986. @cindex Customizing output target names
  1987. @cindex Target names, customizing
  1988. @cindex Id names, customizing
  1989. Similar to file names, so-called target and id names may be set. The
  1990. @dfn{id} is placed where the item is located, while the @dfn{target}
  1991. is used to construct references to that item. Usually, these should
  1992. be the same.
  1993. @c xx, but not always, for example in the default case, the
  1994. @c xx target for a section is the node id.
  1995. The following function reference is for target items (nodes, anchors,
  1996. floats):
  1997. @deftypefn {Function Reference} {($target,$id)} node_target_name @
  1998. \%node $default_target $default_id $type
  1999. @var{\%node} is the same as in the @code{node_file_name} function
  2000. reference in the previous section. @var{$default_target} is the
  2001. target that has been already set (it is also in
  2002. @code{$node->@{'target'@}}), and @var{$default_id} is, similarly, the
  2003. id already set. @var{$type} is @code{top} if the node is the top
  2004. node. The function should return a two-element list of the target and
  2005. id names.
  2006. @end deftypefn
  2007. For elements (@pxref{Output Elements Defined}), the function
  2008. reference is:
  2009. @deftypefn {Function Reference} {($target,$id)} element_target_name @
  2010. \%element $default_target $default_id
  2011. @var{\%element} is the same as in @code{element_file_name} in the
  2012. previous section, and @var{$default_target}, @var{$default_id}, and
  2013. the return value, are as above.
  2014. @end deftypefn
  2015. The file, target, and id of ``placed'' items, namely floats,
  2016. footnotes, index entries, anchors, contents, shortcontents and
  2017. headings, may also be set, although the default should be suitable.
  2018. Nevertheless, the following function reference can be used:
  2019. @deftypefn {Function Reference} {($target, $id, $file)} @
  2020. placed_target_file_name \%placed_item \%element @
  2021. $default_target $default_id $default_file $context
  2022. @var{\%placed_item} is a hash reference describing the placed item, as
  2023. in the above, likewise @var{\%element}. @var{$default_file},
  2024. @var{default_id} and @var{$default_target} are the file, id and target
  2025. already set. @var{$context} describes the context; this is set to
  2026. @samp{footnotes} if in footnotes, to @samp{no_associated_element} if
  2027. the placed item is outside of any element (e.g., @code{@@titlepage},
  2028. @code{@@copying}), and is otherwise empty.
  2029. @end deftypefn
  2030. @vindex %misc_pages_targets
  2031. For special elements, the @code{%misc_pages_targets} hash is used to
  2032. set the target and id. The possibilities for the keys are
  2033. @samp{Overview}, @samp{Contents}, @samp{Footnotes} and @samp{About}.
  2034. @node Customizing HTML Headings
  2035. @section Customizing HTML Headings
  2036. @cindex Headings, customizing HTML
  2037. A function reference may be defined to do the formatting of the heading
  2038. text (usually changing font and underlining):
  2039. @deftypefn {Function Reference} $heading_text_formatted heading_text @
  2040. $command $text $level
  2041. @var{$command} is the @@-command name associated with the heading.
  2042. @var{$text} is the heading @@-command argument, formatted.
  2043. @var{$level} is the level of the heading in the document tree.
  2044. @end deftypefn
  2045. @findex heading_text_preformatted
  2046. A similar function reference is available for preformatted context,
  2047. @code{heading_text_preformatted}.
  2048. A function controls the formatting of element headings,
  2049. @code{heading}. By default its main job is to determine whether the
  2050. @code{heading_text} function reference should be called. Normally,
  2051. heading text is not output for a node on its, only for any associated
  2052. sectioning element (@pxref{Two Paths}).
  2053. @deftypefn {Function Reference} $heading_text heading \%element $command @
  2054. $command_texi_arg $formatted_arg $in_preformatted $one_section @
  2055. $element_heading
  2056. @table @var
  2057. @item \%element
  2058. A hash reference representing the sectioning element. The
  2059. following keys are of interest:
  2060. @table @code
  2061. @item text
  2062. The heading text.
  2063. @item text_nonumber
  2064. The heading text without section number.
  2065. @item node
  2066. True if the sectioning element is a node without an associated
  2067. structuring command.
  2068. @item level
  2069. The level of the element in the document tree: @samp{0} for
  2070. @code{@@top}, @samp{1} for @code{@@chapter}, and so on.
  2071. @item tag_level
  2072. The sectioning element name, with @code{@@raisesections} and
  2073. @code{@@lowersections} taken into account.
  2074. @item top
  2075. True if it is the top element.
  2076. @end table
  2077. @item $command
  2078. The heading @@-command.
  2079. @item $command_texi_arg
  2080. The argument of the @@-command, unformatted.
  2081. @item $formatted_arg
  2082. The argument of the @@-command, formatted.
  2083. @item $in_preformatted
  2084. True if in preformatted environment.
  2085. @item $one_section
  2086. True if there is only one section.
  2087. @item $element_heading
  2088. True if the heading is the main component of the element.
  2089. @end table
  2090. @end deftypefn
  2091. It is also possible to customize the heading text with section number
  2092. with this function reference (called for headings and nodes):
  2093. @deftypefn {Function Reference} $result_texi heading_texi @
  2094. $heading_command $heading $number
  2095. @var{$heading_command} is the sectioning @@-command of that heading.
  2096. @var{$heading} is the Texinfo input for that heading. @var{$number}
  2097. is the heading number classically-computed with dots between numbers,
  2098. and letters for top-level appendix numbering. This function should
  2099. return the Texinfo text corresponding with the numbered heading.
  2100. @end deftypefn
  2101. The label associated with the heading that can appear before the
  2102. heading itself and even before the navigation panel can be customized
  2103. with this function reference:
  2104. @deftypefn {Function Reference} $element_label element_label @
  2105. $identifier \%element $command $unformatted_line
  2106. @var{$identifier} is the identifier associated with the heading.
  2107. @var{\%element} is the same as above. @var{$command} is the
  2108. @@-command appearing on the line, and @var{$unformatted_line} is the
  2109. line, unformatted.
  2110. @end deftypefn
  2111. Additionally, for @code{@@node} and sectioning @@-commands, the
  2112. formatting of the label, navigation panel and heading is controlled
  2113. by:
  2114. @deftypefn {Function Reference} $element_heading_text element_heading @
  2115. \%element $command $command_texi_arg $formatted_arg @
  2116. $in_preformatted $one_section $element_heading $first_in_page @
  2117. $is_top $previous_is_top $unformatted_line $element_id $new_element
  2118. @var{\%element}, @var{$command}, @var{$command_texi_arg},
  2119. @var{$formatted_arg}, @var{$in_preformatted}, @var{$one_section}, and
  2120. @var{$element_heading} are as above. For the rest:
  2121. @table @var
  2122. @item $first_in_page
  2123. True if this is the first heading in a page.
  2124. @item $is_top
  2125. True if the heading is considered as a top element heading.
  2126. @item $previous_is_top
  2127. True if the previous element was a top element.
  2128. @item $unformatted_line
  2129. Holds the whole line, unformatted.
  2130. @item $element_id
  2131. The id of the heading.
  2132. @item $new_element
  2133. True if the heading is the first of an element.
  2134. @end table
  2135. @end deftypefn
  2136. @node Customizing Indices
  2137. @section Customizing Indices
  2138. @cindex Customizing indices
  2139. @cindex Indices, customizing
  2140. @vindex IDX_SUMMARY
  2141. To do something special with index entries outside of the Texinfo
  2142. source document (@pxref{Indices}), you should first set the
  2143. configuration variable @code{IDX_SUMMARY} true. After that, various
  2144. function references will be called for each non-empty index: one for
  2145. initialization, one for each index entry, and one for finalization.
  2146. Another way to work with the index (and tables of contents) entries is
  2147. to specify the @option{--internal-links} option and use the resulting
  2148. table; @pxref{Invoking texi2any}.
  2149. @deffn {Function Reference} index_summary_file_begin $index_name @
  2150. $is_printed $manual_name
  2151. This function is called once for each non-empty index used in the
  2152. document, before any calls to @code{index_summary_file_entry}.
  2153. @table @var
  2154. @item $index_name
  2155. The two-letter name of the index.
  2156. @item $is_printed
  2157. True if this index has a corresponding @code{@@printindex} command.
  2158. @item $manual_name
  2159. The manual basename.
  2160. @end table
  2161. @end deffn
  2162. @deffn {Function Reference} index_summary_file_entry $index_name @
  2163. $entry_text $entry_reference $formatted_entry $texi_entry @
  2164. $entry_element_reference $entry_element_header $is_printed $manual_name
  2165. This function is called for each entry of an index, in sorted order.
  2166. The sorting happens regardless of whether the index is actually printed.
  2167. @table @var
  2168. @item $index_name
  2169. The two-letter name of the index.
  2170. @item $entry_text
  2171. @itemx $formatted_entry
  2172. @itemx $texi_entry
  2173. The entry in plain text, formatted, and original source, respectively.
  2174. @item $entry_reference
  2175. The reference used for the index entry, in the form @samp{file#id}.
  2176. @item $entry_element_reference
  2177. The reference to the beginning of the element containing the index
  2178. entry, also in the form @samp{file#id} (@pxref{Output Elements
  2179. Defined}).
  2180. @item $entry_element_header
  2181. The formatted header of the element containing the index entry.
  2182. @item $is_printed
  2183. True if this index has a corresponding @code{@@printindex} command.
  2184. @item $manual_name
  2185. The manual basename.
  2186. @end table
  2187. @end deffn
  2188. @deffn {Function Reference} index_summary_file_end $index_name $is_printed @
  2189. $manual_name
  2190. This function is called once for each non-empty index used in the
  2191. document, after all calls to @code{index_summary_file_entry}. The
  2192. arguments are the same as for @code{index_summary_file_begin}, above.
  2193. @end deffn
  2194. @node Customizing CSS
  2195. @section Customizing the CSS lines
  2196. @cindex Customizing CSS
  2197. @cindex CSS customization
  2198. @vindex %css_map
  2199. @vindex INLINE_CSS
  2200. @vindex NO_CSS
  2201. The @code{NO_CSS} configuration option turns off CSS support. Instead
  2202. of CSS lines being output at the beginning of the document, they may
  2203. be added to HTML attributes, if @code{INLINE_CSS} is set.
  2204. The configuration variable holds the CSS specification lines when CSS
  2205. is not inline. It is possible to modify the CSS lines by modifying
  2206. the entries or adding to the @code{%css_map} hash. Each key is a CSS
  2207. selector, the corresponding value is a style string.
  2208. It is also possible to change completely how CSS lines are generated
  2209. by redefining the following function reference:
  2210. @deffn {Function Reference} css_lines \@@import_lines \@@rule_lines
  2211. This function should set the variable @code{CSS_LINES}.
  2212. @var{\@@import_lines} is an array reference holding the
  2213. @code{@@import} lines of the files specified with
  2214. @option{--include-css}. @var{\@@rule_lines} is an array reference
  2215. holding the CSS lines of those. files.
  2216. @end deffn
  2217. * Customizing HTML Basic Commands:: Commands with no arguments, images, etc.
  2218. * Customizing HTML References:: @code{@@xref}, external node pointers, etc.
  2219. * Customizing HTML Footnotes:: Footnotes.
  2220. * Customizing HTML Block Commands:: Environments.
  2221. * Paragraph and preformatted region::
  2222. * Lists tables and definitions formatting::
  2223. * Menus indices and floats formatting::
  2224. * Handling special regions::
  2225. * Other and unknown commands::
  2226. @node Customizing HTML Basic Commands
  2227. @section Customizing HTML Basic Commands
  2228. This section describes customizing the HTML output for the basic
  2229. Texinfo commands used within the running text.
  2230. @menu
  2231. * Argless: HTML Customization for Commands Without Arguments.
  2232. * @@-Colon: HTML Customization After @@-Colon.
  2233. * Simple: HTML Customization for Simple Commands. Indicators, accents, etc.
  2234. * Anchors: HTML Customization for Anchors.
  2235. * Images: HTML Customization for Images.
  2236. * sp: HTML Customization for @code{sp}.
  2237. * Abbrs: HTML Customization for Abbreviations. @code{@@acronym}, @code{@@abbr}.
  2238. * Text: HTML Customization for Text Sequences. @code{-- --- `` ''}, etc.
  2239. * Title: HTML Customization for Title Commands. @code{@@title}, etc.
  2240. @end menu
  2241. @node HTML Customization for Commands Without Arguments
  2242. @subsection HTML Customization for Commands Without Arguments
  2243. @cindex HTML customization for commands without arguments
  2244. @cindex Commands without arguments, customizing HTML for
  2245. @cindex Insertion commands, customizing HTML for
  2246. These commands include those whose names are a single nonletter
  2247. character, such as @code{@@@@}, and those with a normal alphabetic
  2248. name but whose braces should be empty, such as @code{@@TeX@{@}} and
  2249. @code{@@AA@{@}}.
  2250. Each of these categories of commands have associated hashes for each
  2251. expansion context: normal, preformatted, string, and math (@pxref{Init
  2252. File Expansion Contexts}). The keys of each hash are the command
  2253. names, the associated value is the text replacing the command. In
  2254. math context, if a command is not a key of these hashes, the defaults
  2255. for the command are used.
  2256. @vindex %simple_map
  2257. @vindex %things_map
  2258. @vindex %simple_map_pre
  2259. @vindex %pre_map
  2260. @vindex %simple_map_texi
  2261. @vindex %texi_map
  2262. @vindex %simple_map_math
  2263. @vindex %math_map
  2264. The hashes are:
  2265. @multitable {preformatted} {one nonlettered character} {empty braces}
  2266. @headitem command type @tab one nonlettered character @tab empty braces
  2267. @item normal @tab @code{%simple_map} @tab @code{%things_map}
  2268. @item preformatted @tab @code{%simple_map_pre} @tab @code{%pre_map}
  2269. @item string @tab @code{%simple_map_texi} @tab @code{%texi_map}
  2270. @item math @tab @code{%simple_map_math} @tab @code{%math_map}
  2271. @end multitable
  2272. To change the formatting of a command, change the associated value in
  2273. the desired hash. For example, if you want @code{&shy;} to be output
  2274. for @code{@@-} in normal and preformatted context, write this in your
  2275. init file:
  2276. @example
  2277. $simple_map@{'-'@} = '&shy;';
  2278. $simple_map_pre@{'-'@} = '&shy;';
  2279. @end example
  2280. @vindex %sorting_things_map
  2281. An additional hash is used preferentially when sorting indices,
  2282. overriding @code{%texi_map} entries: @code{%sorting_things_map}.
  2283. For better control, function references are available, although they
  2284. are not used in string context. @code{simple_command} is for
  2285. formatting of the single-nonletter @@-commands:
  2286. @deftypefn {Function Reference} $formatted_command simple_command
  2287. @ $command $in_preformatted $in_math $line_nr \%state
  2288. @var{$command} is the @@-command name. @var{$in_preformatted} is true
  2289. if in a preformatted region. @var{$in_math} is true if in math.
  2290. @var{$line_nr} is an opaque structure containing information about the
  2291. line number of the @@-command. @var{\%state} holds information about
  2292. the current context.
  2293. @end deftypefn
  2294. For @@-commands with empty brace arguments, @code{thing_command} may
  2295. be redefined:
  2296. @deftypefn {Function Reference} $formatted_command thing_command
  2297. @ $command $text $in_preformatted $in_math $line_nr \%state
  2298. @var{$text} is the formatted text appearing in the @@-command. It is
  2299. invalid Texinfo to have anything other than the empty string there.
  2300. @var{$command}, @var{$in_preformatted}, @var{$in_math},
  2301. @var{$line_nr}, and @var{\%state} are as above.
  2302. @end deftypefn
  2303. @node HTML Customization After @@-Colon
  2304. @subsection HTML Customization After @@-Colon
  2305. @cindex HTML customization after @code{@@:}
  2306. @cindex Punctuation after @code{@@:}, customizing HTML for
  2307. @cindex Sentence punctuation, customizing HTML for
  2308. @vindex %colon_command_punctuation_characters
  2309. The formatting of a punctuation character followed by @code{@@:} is
  2310. determined by the hash @code{%colon_command_punctuation_characters}.
  2311. If a @code{@@:} command is preceded by a character in this hash, it is
  2312. replaced by the associated value. By default, the associated value is
  2313. also the character, so this leaves the punctuation character
  2314. unmodified.
  2315. The following function reference may be redefined to handle characters
  2316. that are in @code{%colon_command_punctuation_characters}:
  2317. @deftypefn {Function Reference} $punctuation colon_command $character
  2318. @var{$character} is a character appearing in
  2319. @code{%colon_command_punctuation_characters} and preceding an
  2320. @code{@@:} command. By default, the associated value in
  2321. @code{%colon_command_punctuation_characters} is returned.
  2322. @end deftypefn
  2323. @node HTML Customization for Simple Commands
  2324. @subsection HTML Customization for Simple Commands
  2325. @cindex HTML customization for simple commands
  2326. @cindex Simple commands, customizing HTML for
  2327. @cindex Style commands, customizing HTML for
  2328. @cindex Accent commands, customizing HTML for
  2329. @vindex %style_map
  2330. @vindex %style_map_pre
  2331. @vindex %style_map_texi
  2332. @vindex %style_map_math
  2333. The formatting of the output produced by ``indicator'' and font
  2334. commands (e.g., @code{@@code}, @code{@@t}, @code{@@titlefont}), the
  2335. accent-related commands with arguments (e.g., @code{@@'},
  2336. @code{@@udotaccent}, @code{@@dotless}) and other simple commands with
  2337. arguments (e.g., @code{@@w}, @code{@@uref}, @code{@@math},
  2338. @code{@@asis}) is controlled by the following hashes by default
  2339. (@pxref{Init File Expansion Contexts}):
  2340. @table @code
  2341. @item %style_map
  2342. In normal context.
  2343. @item %style_map_pre
  2344. In preformatted context.
  2345. @item %style_map_texi
  2346. In string context.
  2347. @item %style_map_math
  2348. Preferentially in math context, falling back to other hashes if not found.
  2349. @end table
  2350. If defined, a function reference is called at the @@-command opening:
  2351. @deffn {Function Reference} begin_style_texi $command \%state \@@stack @
  2352. $real_style_or_accent $remove_texi
  2353. @table @var
  2354. @item $command
  2355. The @@-command name.
  2356. @item \%state
  2357. Information about the current context.
  2358. @item \@@stack
  2359. An opaque variable.
  2360. @item $real_style_or_accent
  2361. Set if the command is an accent or a font command.
  2362. @item $remove_texi
  2363. Set if in a context where output is simple text.
  2364. @end table
  2365. @end deffn
  2366. @vindex %accent_map
  2367. The nonlettered accent commands where the following character is taken
  2368. as the argument (e.g., @code{@@`a}) should be keys of the
  2369. @code{%accent_map} hash, even if no value is associated.
  2370. Command with braces may be handled differently; @pxref{Init File
  2371. Formatting of Commands}. For example, this is used for @code{@@math}
  2372. if @LaTeX{}2HTML is used.
  2373. The key of the hashes are the command names. The values may be
  2374. strings or hash references. The hash reference interface is the only
  2375. one described in this manual, the other is retained primarily for
  2376. backward compatibility. You can also define your own interface.
  2377. @menu
  2378. * Hash Interface for Simple HTML Customization::
  2379. * Custom Interface for Simple HTML Customization::
  2380. @end menu
  2381. @node Hash Interface for Simple HTML Customization
  2382. @subsubsection Hash Interface for Simple HTML Customization
  2383. @cindex Hash interface for simple HTML customization
  2384. @cindex Interface for simple HTML customization, hash
  2385. The keys of the hashes given above are Texinfo command names. The
  2386. values determine how the command argument is formatted. Each value is
  2387. a hash reference. In this value hash, each key corresponds with a
  2388. type of information for formatting, and the value is the corresponding
  2389. data.
  2390. Here's an example:
  2391. @example
  2392. $style_map@{'command'@} = @{
  2393. 'args' => ['code'],
  2394. 'inline_attribute' => 'code',
  2395. @};
  2396. @end example
  2397. Here, the arguments for @code{@@command} are interpreted as specified
  2398. by the values associated with the @samp{args} key, namely a code
  2399. argument; and the @code{inline_attribute} associated with that command
  2400. is @samp{<code>}.
  2401. Here is a list of the possible keys in the value hashes:
  2402. @table @samp
  2403. @item args
  2404. @anchor{Reference Hash Args}
  2405. The value associated is an array reference. Each element of the array
  2406. defines how the corresponding argument (separated by @samp{,} in the
  2407. Texinfo input) for the @@-command should be formatted. The
  2408. possibilities are:
  2409. @table @code
  2410. @item normal
  2411. for normal text,
  2412. @item code
  2413. for text where @samp{---}, @samp{--}, @samp{''}, and @samp{``} should
  2414. be kept as-is, and
  2415. @item keep
  2416. if the input should be kept entirely as-is, with no interpretation of
  2417. any @@-commands.
  2418. @end table
  2419. The default is @samp{['normal']} for one normally-interpreted argument.
  2420. For example, we specify
  2421. @example
  2422. $style_map@{'email'@}->@{'args'@} = ['code', 'normal'];
  2423. @end example
  2424. because @samp{---}, @samp{--}, @samp{''} and @samp{``} should be kept
  2425. as-is in the first argument of @code{@@email}
  2426. (@pxref{email,, @code{@@email}}).
  2427. @item attribute
  2428. If the associated value is a word, it is considered to be an XML
  2429. element name, and the argument is enclosed between the element opening
  2430. and the element closing. For example, if the value is @code{elem}, the
  2431. resulting HTML is @code{<elem>@var{arg}</elem>}.
  2432. If the text is a word followed by some text, the word is interpreted
  2433. as above, and the text is considered to be the attributes text of the
  2434. element. Thus @code{elem class="elem"} leads to @code{<elem
  2435. class="elem">@var{arg}</elem>}. This only works if there is only one
  2436. argument.
  2437. @item inline_attribute
  2438. Like @code{attribute}, except that it is closed at each paragraph end
  2439. and reopened at each beginning of paragraph. This is more often used
  2440. than @samp{attribute} since it allows to have well-formed HTML and
  2441. XML.
  2442. @item inline_begin
  2443. The associated value is added in front of the text and each time a
  2444. paragraph is restarted while within the command.
  2445. @item inline_end
  2446. The associated value is added after the text and each time a paragraph
  2447. is ended while within the command.
  2448. @item begin
  2449. The associated value is added in front of the text.
  2450. @item end
  2451. The associated value is added after the text.
  2452. @item quotes
  2453. If the corresponding value is true, the result is enclosed in quotes
  2454. associated with configuration variables @code{OPEN_QUOTE_SYMBOL} and
  2455. @code{CLOSE_QUOTE_SYMBOL}; the defaults depend on the output format
  2456. but fall back to @samp{`} and @samp{'}.
  2457. @item function
  2458. The corresponding value should be a function reference, which is
  2459. called with the following arguments:
  2460. @table @code
  2461. @item $command
  2462. The @@-command name.
  2463. @item \@@args
  2464. An array reference containing the arguments of the @@-command.
  2465. @item \@@command_stack
  2466. An array reference with the names of the @@-commands containing the
  2467. @@-command being formatted, latest on top.
  2468. @item \%state
  2469. A hash reference containing context information.
  2470. @item $line_nr
  2471. An opaque structure containing line number information for the
  2472. @@-command. It can be used to call @code{main::line_error} or
  2473. @code{main::line_warn} with the first argument being the message, and
  2474. the second argument @code{$line_nr}.
  2475. @item \@@line_numbers
  2476. An array reference containing the line numbers (the same opaque
  2477. structure as above) of the lines produced by the @@-command.
  2478. @end table
  2479. @end table
  2480. @node Custom Interface for Simple HTML Customization
  2481. @subsubsection Custom Interface for Simple HTML Customization
  2482. @cindex Custom interface for simple HTML customization
  2483. @cindex Interface for simple HTML customization, custom
  2484. If the hash interface described in the previous section does not
  2485. suffice, it is possible to change how the ``simple'' Texinfo commands
  2486. are processed by redefining the following function reference:
  2487. @deftypefn {Function Reference} $resulting_text style $style $command $text @
  2488. $args $no_close $no_open $line_nr \%state $command_stack \@@line_numbers
  2489. @table @var
  2490. @item $command
  2491. The @@-command
  2492. @item $style
  2493. The value associated with the @var{$command} in the @code{%style_map},
  2494. @code{%style_map_pre} or @code{%style_map_texi} hashes.
  2495. @item $text
  2496. The argument text appearing within the @@-command braces.
  2497. @item $args
  2498. Array reference containing the command arguments, formatted according
  2499. to the same conventions as the hash reference style (provided that the
  2500. value associated with the @@-command is a hash reference with an
  2501. @var{$arg} key; @pxref{Reference Hash Args}).
  2502. @item $no_close
  2503. @itemx $no_open
  2504. If @var{$text} is split into paragraphs, each paragraph is passed
  2505. through the function, and @var{$no_close} is true if this is not the
  2506. last paragraph, while @var{$no_open} is true if this is not the first
  2507. paragraph.
  2508. @item $line_nr
  2509. @itemx \%state
  2510. @itemx $command_stack
  2511. @itemx \@@line_numbers
  2512. See the previous section.
  2513. @end table
  2514. @end deftypefn
  2515. @node HTML Customization for Anchors
  2516. @subsection HTML Customization for Anchors
  2517. @cindex HTML customization for anchors
  2518. @cindex Anchors, customizing HTML for
  2519. The HTML formatting of anchors (@pxref{anchor,, @code{@@anchor}}) is
  2520. controlled by functions. To customize the output, the function
  2521. reference @code{$anchor_label} should be redefined. The function
  2522. should return the formatted text.
  2523. @deftypefn {Function Reference} $anchor_label anchor_label $identifier $anchor
  2524. @var{$identifier} is the anchor identifier, and @var{$anchor} is the
  2525. @code{@@anchor} argument.
  2526. @end deftypefn
  2527. By default, this uses a function reference, @code{$anchor}, which can
  2528. do a reference target or link. This is especially relevant for HTML
  2529. but can potentially be used in other formats, since it is a rather
  2530. common element among output formats.
  2531. @deftypefn {Function Reference} $anchor anchor @
  2532. $identifier $href $text $attributes
  2533. If @var{$identifier} is not empty, its value should be used to create
  2534. a target for links (typically associated with a name or id attribute
  2535. in HTML). The @var{$href} argument specifies a hypertext reference
  2536. which should be used to link to a target. If both @var{$identifier}
  2537. and @var{$href} are given, the text produced should be both a target
  2538. for @var{$identifier} and a link to @var{$href}. @var{$text} is the
  2539. text to be displayed. @var{$attributes} are additional attributes for
  2540. an @code{<a>} HTML element.
  2541. @end deftypefn
  2542. @node HTML Customization for Images
  2543. @subsection HTML Customization for Images
  2544. @cindex HTML customization for images
  2545. @cindex Images, customizing HTML for
  2546. @vindex @@IMAGE_EXTENSIONS
  2547. To customize the images produced by @code{@@image} (@pxref{Images}),
  2548. the first possibility is to modify the @code{@@IMAGE_EXTENSIONS}
  2549. array, which holds a list of filename extensions for image files.
  2550. Second, it is also possible to redefine the function used to determine
  2551. the filename of the image:
  2552. @deftypefn {Function Reference} $filename image_files @
  2553. $basename $extension $texi_base $texi_extension
  2554. @var{$basename} is the first @code{@@image} argument, and
  2555. @var{$extension} is the corresponding @code{@@image} argument; both
  2556. are formatted. @var{$texi_base} is the first @code{@@image} argument
  2557. and @var{$texi_extension} is the extension, unformatted. This
  2558. function reference should return an array of array references, each
  2559. holding both formatted and unformatted image filenames without any path
  2560. for which the main program should look.
  2561. @end deftypefn
  2562. Third, it is possible to control the formatting of @code{@@image} by
  2563. redefining this:
  2564. @deftypefn {Function Reference} $image image $file_path $basename @
  2565. $preformatted $file_name $alt_text $width $height $raw_alt @
  2566. $extension $working_dir $file_relative_path $in_paragraph @
  2567. \@@file_locations $base_simple_format @
  2568. $extension_simple_format $file_name_simple_format $line_nr
  2569. @table @var
  2570. @item $file_path
  2571. The image file name with the path from the output directory to the
  2572. source manual directory prepended.
  2573. @item $basename
  2574. The file name without extension---the first argument to the
  2575. @code{@@image} command.
  2576. @item $preformatted
  2577. True if the image appears in preformatted text.
  2578. @item $file_name
  2579. The file name without path but with extension.
  2580. @item $alt_text
  2581. The alternate text, possibly undefined.
  2582. @item $width
  2583. @itemx $height
  2584. The corresponding @code{@@image} arguments.
  2585. @item $raw_alt
  2586. The unmodified alternate-text @code{@@image} argument.
  2587. @item $extension
  2588. The corresponding @code{@@image} argument.
  2589. @item $working_dir
  2590. Path to the working directory relative to the output directory.
  2591. @item $file_relative_path
  2592. The file name relative to @var{$working_dir}.
  2593. @item $in_paragraph
  2594. True if within a paragraph.
  2595. @item \@@file_locations
  2596. Array reference holding another array reference with 3 elements: the
  2597. file name array reference as returned by @code{image_files}; the image
  2598. location if it was found, or undef; and the file name formatted using
  2599. simple formatting in string context.
  2600. @item $base_simple_format
  2601. @itemx $extension_simple_format
  2602. @itemx $file_name_simple_format
  2603. The corresponding arguments formatted using simple formatting in
  2604. string context.
  2605. @item $line_nr
  2606. An opaque structure containing the information about the line number
  2607. of the @@-command.
  2608. @end table
  2609. @end deftypefn
  2610. @node HTML Customization for @code{sp}
  2611. @subsection HTML Customization for @code{sp}
  2612. @cindex HTML customization for @code{sp}
  2613. @cindex @code{sp}, customizing HTML for
  2614. The formatting of @code{@@sp} (@pxref{sp,,@code{@@sp}}) is controlled by:
  2615. @deftypefn {Function Reference} $sp sp $number $preformatted
  2616. @var{$number} is the numeric argument of @code{@@sp}.
  2617. @var{$preformatted} is true if the @code{@@sp} appears in preformatted
  2618. text.
  2619. @end deftypefn
  2620. @node HTML Customization for Abbreviations
  2621. @subsection HTML Customization for Abbreviations
  2622. @cindex HTML customization for abbreviations
  2623. @cindex @code{abbr}, customizing HTML for
  2624. @cindex @code{acronym}, customizing HTML for
  2625. The formatting of @code{@@acronym} and @code{@@abbr} (@pxref{acronym,,
  2626. @code{@@acronym}} and @ref{abbr,, @code{@@abbr}}) is controlled by:
  2627. @deftypefn {Function Reference} $acronym acronym_like @
  2628. $acronym_texi $acronym_text $with_explanation \@@explanation_lines @
  2629. $explanation_text $explanation_simply_formatted
  2630. @var{$acronym_texi} is the original acronym argument with @@-commands,
  2631. while @var{$acronym_text} is formatted.
  2632. The other arguments are related to the explanation (the second arg of
  2633. the acronym). @var{$with_explanation} is true if the second argument
  2634. of the acronym command is present. If an explanation exists, coming
  2635. from a previous @code{@@acronym} or as an argument to the present
  2636. command, the remaining arguments are defined:
  2637. @table @var
  2638. @item \@@explanation_lines
  2639. Array reference containing simply formatted explanation lines
  2640. (@pxref{Init File Expansion Contexts}).
  2641. @item $explanation_text
  2642. Formatted explanation text.
  2643. @item $explanation_simply_formatted
  2644. Explanation simply formatted in a string context.
  2645. @end table
  2646. @end deftypefn
  2647. @node HTML Customization for Text Sequences
  2648. @subsection HTML Customization for Text Sequences
  2649. @cindex HTML customization for text sequences
  2650. @cindex Text sequences, customizing HTML for
  2651. @cindex Ligatures in text, customizing HTML for
  2652. Some character sequences are processed especially in text: @samp{---},
  2653. @samp{--}, @samp{``} and @samp{''}. This should only be done only if
  2654. in normal text and not within commands for preformatted output
  2655. (@code{@@code}, @code{@@env}@dots{}). A function reference is called
  2656. to process the text and take care of these constructs. It may also be
  2657. used to transform the text, for example, convert to upper case if it
  2658. is in @code{@@sc}. The function should also take care of protecting
  2659. special characters.
  2660. @deftypefn {Function Reference} $processed_text normal_text $text @
  2661. $in_raw_text $in_preformatted $in_code $in_math $in_simple $command_stack
  2662. Process @var{$text} and return @var{$processed_text}. The other
  2663. arguments give some information about the context of the text.
  2664. @table @var
  2665. @item $in_raw_text
  2666. True if the text appears in a place where there is no formatting at
  2667. all; e.g., in comments.
  2668. @item $in_preformatted
  2669. True if within a preformatted environemnt
  2670. @item $in_code
  2671. True if within a special command such as @code{@@code} or @code{@@env}
  2672. where the text sequences should be left as is.
  2673. @item $in_math
  2674. True if within @code{@@math}.
  2675. @item $in_simple
  2676. True if in a string context with minimal formatting.
  2677. @item $command_stack
  2678. Array containing the name of the formatting @@-commands that enclose
  2679. the text.
  2680. @end table
  2681. By default, the @samp{---}, @samp{--}, @samp{``} and @samp{''}
  2682. constructs are expanded if needed and the text is upper-cased if in
  2683. @code{@@sc}. Special characters (@samp{&}, @samp{"}, @samp{<} and
  2684. @samp{>} in HTML) are protected if needed.
  2685. @end deftypefn
  2686. @cindex Protecting special output characters
  2687. @cindex Output format characters, protecting
  2688. @cindex HTML characters, protecting
  2689. Some characters are special in a particular output format, such as
  2690. @samp{<} in HTML. Some text is not processed by the above function,
  2691. but still needs protection before output. This is done by the
  2692. following:
  2693. @deftypefn {Function Reference} $protected_text protect_text $text
  2694. Process the general text @var{$text} and return the resulting
  2695. protected text @var{$protected_text}.
  2696. @end deftypefn
  2697. @cindex Empty lines, removing
  2698. Empty lines are processed by the following function reference, which
  2699. can be useful if empty lines are to be removed.
  2700. @cindex Definition commands, empty lines after
  2701. @deftypefn {Function Reference} $resulting_text empty_line $empty_line $state
  2702. Process @var{$empty_line} and return @var{$resulting_text}.
  2703. @var{$state} is a structure holding information about the state of
  2704. parsing. By default, empty lines are left as-is except right after a
  2705. definition @@-command.
  2706. @end deftypefn
  2707. @node HTML Customization for Title Commands
  2708. @subsection HTML Customization for Title Commands
  2709. @cindex HTML customization for title commands
  2710. @cindex Title commands, customizing HTML for
  2711. @vindex %line_command_map
  2712. Some @@-commands related to titles appear on a line by themselves and
  2713. take the rest of the line as their argument: @code{@@titlepage},
  2714. @code{@@title}, @code{@@subtitle}, and @code{@@author}
  2715. (@pxref{Titlepage & Copyright Page}). These are listed in
  2716. @code{%line_command_map} and the following function reference is used
  2717. to format them:
  2718. @deftypefn {Function Reference} $resulting_text line_command @
  2719. $command $arg_text $arg_texi \%state
  2720. @var{$command} is the @@-command, @var{$arg_text} is the
  2721. @@-command's formatted argument, and @var{$arg_texi} is the @@-command
  2722. argument without any formatting. @var{\%state} is a hash reference
  2723. containing context information. The function returns
  2724. @var{$resulting_text}.
  2725. @end deftypefn
  2726. For more customization of title pages, @pxref{HTML Title Page
  2727. Customization}.
  2728. @node Customizing HTML References
  2729. @section Customizing HTML References
  2730. @cindex References, HTML customization for
  2731. @cindex Cross references, HTML customization for
  2732. @menu
  2733. * Internal: HTML Customization for Internal References.
  2734. * External: HTML Customization for External References.
  2735. @end menu
  2736. @node HTML Customization for Internal References
  2737. @subsection HTML Customization for Internal References
  2738. @cindex HTML customization for internal references
  2739. @cindex Internal references, HTML customization for
  2740. This function reference is used to format a reference to a node in the
  2741. current manual (@pxref{Cross References}).
  2742. @deftypefn {Function Reference} $text internal_ref $command $href $short_name @
  2743. $name $is_section \@@args_texi \@@formatted_args \%element
  2744. @table @var
  2745. @item $command
  2746. The reference command, namely @code{ref}, @code{xref}, @code{pxref} or
  2747. @code{inforef}).
  2748. @item $href
  2749. An HTML href to the node.
  2750. @item $short_name
  2751. @itemx $name
  2752. The text for the reference. @var{$short_name} can be the node name
  2753. which is assumed to be no longer than the section name.
  2754. @item $is_section
  2755. True if the reference is to a sectioning element.
  2756. @item \@@args_texi
  2757. @itemx \@@formatted_args
  2758. Array references containing the @@-command arguments, not formatted
  2759. and formatted, respectively.
  2760. @item \%element
  2761. Hash reference with information about the target element of the
  2762. reference.
  2763. @end table
  2764. The function should return the full formatted text of the internal
  2765. reference.
  2766. @end deftypefn
  2767. @node HTML Customization for External References
  2768. @subsection HTML Customization for External References
  2769. @cindex HTML customization for external references
  2770. @cindex External references, HTML customization for
  2771. These references are produced by one of two function references:
  2772. @code{external_href} is used for menu items which refer to other
  2773. manuals (@pxref{Other Info Files}), while @code{external_ref} is used
  2774. for full external cross references (@pxref{Four and Five Arguments}).
  2775. @deftypefn {Function Reference} $href external_href $node $node_identifier @
  2776. $xml_node_identifier $file
  2777. This function formats a reference to a node in an external Texinfo manual.
  2778. @table @var
  2779. @item $node
  2780. The node name, with @@-commands.
  2781. @item $node_identifer
  2782. The node name mapped to an identifier acceptable as a file name.
  2783. @item $xml_node_identifier
  2784. The node name mapped to an identifier acceptable for XML.
  2785. @item $file
  2786. The manual file name of the external reference.
  2787. @end table
  2788. The function should return an HTML href for the external reference.
  2789. @xref{HTML Xref}, for how the identifiers are built in order to allow
  2790. for cross references to external manuals to succeed.
  2791. @end deftypefn
  2792. @deftypefn {Function Reference} $text external_ref $command $section $book @
  2793. $file $href $cross_ref_name \@@args_texi \@@formatted_args $node
  2794. This function formats a general cross reference to an external Texinfo manual.
  2795. @table @var
  2796. @item $command
  2797. The reference command (@code{ref}, @code{xref}, @code{pxref} or
  2798. @code{inforef}).
  2799. @item $section
  2800. The section in the external manual; may be empty.
  2801. @item $book
  2802. The book title; may be empty.
  2803. @item $file
  2804. The manual file name.
  2805. @item $href
  2806. An HTML href to the external manual constructed using the above
  2807. @code{external_href} function.
  2808. @item $cross_ref_name
  2809. Optional cross reference name appearing in the reference command.
  2810. @item \@@args_texi
  2811. @itemx \@@formatted_args
  2812. Array references containing the @@-command arguments, not formatted
  2813. and formatted, respectively.
  2814. @item $node
  2815. The node name, formatted.
  2816. @end table
  2817. The function should return the HTML text for the external manual
  2818. reference.
  2819. @end deftypefn
  2820. @node Customizing HTML Footnotes
  2821. @section Customizing HTML Footnotes
  2822. @cindex Customizing HTML footnotes
  2823. @cindex Footnotes, customizing HTML
  2824. Each footnote is associated with a footnote entry. Several footnote
  2825. entries are grouped in a footnote section. When a footnote appears,
  2826. two things must be formatted: the footnote text, and the place in the
  2827. main text where the footnote marker appears.
  2828. It is possible to replace the footnote with other text before
  2829. formatting the footnote. The following function reference
  2830. is used for this if it is defined:
  2831. @deftypefn {Function Reference} $added_text footnote_texi $footnote_text @
  2832. \%state \@@command_stack
  2833. @table @var
  2834. @item $footnote_text
  2835. The footnote text.
  2836. @item \%state
  2837. Hash referencing with information about the context of the footnote
  2838. location in the main document. Specifically, the entries
  2839. @code{\%state->@{'outside_document'@}} or
  2840. @code{\%state->@{'multiple_pass'@}} can be used.
  2841. @item \@@command_stack
  2842. Array reference containing the commands enclosing the footnote.
  2843. @end table
  2844. This function should return new formatted text for the footnote.
  2845. @end deftypefn
  2846. Two functions, with corresponding function references, control the
  2847. formatting of the footnotes:
  2848. @deftypefn {Function Reference} {(\@@lines $doc_text)} foot_line_and_ref @
  2849. $number_in_doc $number_in_page $footnote_id $place_id @
  2850. $document_file $footnote_file \@@lines \%state
  2851. @table @var
  2852. @item $number_in_doc
  2853. The footnote number counted through the whole document,
  2854. @item $number_in_page
  2855. The footnote number counted on the current page.
  2856. @item $footnote_id
  2857. An identifier for the footnote text, which should be used to make the
  2858. target for references to the footnote.
  2859. @item $place_id
  2860. Identifier for the location of the footnote in the main document.
  2861. @item $document_file
  2862. Name of the file containing the text where the footnote appears in the
  2863. main document
  2864. @item $footnote_file
  2865. Name of the file where the footnote text appears.
  2866. @item \@@lines
  2867. Array reference containing the footnote text lines, formatted.
  2868. @item \%state
  2869. Information about the context at the footnote location in the main
  2870. document. As usual, the most useful entry is @code{preformatted},
  2871. which is true if the footnote appears in a preformatted context.
  2872. @end table
  2873. The function should return a list of two elements: an array reference
  2874. (@var{\@@lines}) containing the updated footnote text for the footnote
  2875. entry, and a string (@var{$doc_text}), for the text to appear at the
  2876. location of the footnote in the main document, i.e., linking to the
  2877. footnote entry.
  2878. @end deftypefn
  2879. The following function is only used when footnotes are at the bottom
  2880. of a page and the document is split. For customization in the case
  2881. when footnotes are on a separate page or section, @pxref{Customizing
  2882. Layout of Special Elements}. The footnote location is determined by
  2883. @code{footnotestyle} (@pxref{Footnote Styles}).
  2884. @deffn {Function Reference} foot_section \@@footnotes_lines
  2885. This function formats a group of footnotes. @var{\@@footnotes_lines}
  2886. is an array reference holding the lines of all the footnote entries
  2887. formatted as explained above. The function should modify the
  2888. reference.
  2889. @end deffn
  2890. @node Customizing HTML Block Commands
  2891. @section Customizing HTML Block Commands
  2892. @cindex Customizing HTML block commands
  2893. @cindex Block commands, customizing HTML
  2894. @cindex Environments, customizing HTML
  2895. @menu
  2896. * Align: HTML Customization of Alignment Commands. @code{@@flushleft}, etc.
  2897. * Preformatted block command formatting::
  2898. * Other block commands formatting::
  2899. @end menu
  2900. @node HTML Customization of Alignment Commands
  2901. @subsection HTML Customization of Alignment Commands
  2902. @cindex HTML customization of alignment environments
  2903. @cindex Customization of alignment environments
  2904. @cindex Alignment environments, HTML customization of
  2905. @cindex @code{@@center}, HTML customization of
  2906. @cindex @code{@@flushleft}, HTML customization of
  2907. @cindex @code{@@flushright}, HTML customization of
  2908. @vindex %paragraph_style
  2909. When a block with special text alignment of text is used, namely
  2910. @code{@@center} (@pxref{titlefont center sp},,
  2911. @code{@@titlefont}@comma{} @code{@@center}@comma{} and @code{@@sp}),
  2912. @code{@@flushleft} or @code{@@flushright} (@pxref{flushleft &
  2913. flushright,, @code{@@flushleft} and @code{@@flushright}}, the main
  2914. program takes care of opening and closing paragraphs. The alignment
  2915. commands are the keys in the @code{%paragraph_style} hash. The value
  2916. is used in the function doing the formatting of the paragraphs
  2917. (@pxref{Paragraph and preformatted region}).
  2918. This function reference allows for customizing the formatting of the
  2919. command argument.
  2920. @deftypefn {Function Reference} $result paragraph_style_command $command $text
  2921. @var{$command} is the command name and @var{$text} is the text
  2922. appearing within the command. This function should return the
  2923. formatted text. The default is to return the text unmodified.
  2924. @end deftypefn
  2925. @node Preformatted block command formatting
  2926. @subsection Preformatted block command (@code{@@example}, @code{@@display}@dots{}) formatting
  2927. Here we see how a whole preformatted block command is
  2928. formatted. For the formatting
  2929. of the text, see @ref{Paragraph and preformatted region}.
  2930. @vindex %complex_format_map
  2931. The formatting of the block commands is ultimately controlled by a
  2932. function, however the default for this function uses a hash and
  2933. changing the hash values should be enough in most cases. This
  2934. hash is called @code{%complex_format_map}. It has a key for each
  2935. of the preformatted block commands (@code{example}, @code{smallexample},
  2936. @code{lisp}, @code{smalllisp}, @code{display}, @code{smalldisplay},
  2937. @code{format}, @code{smallformat}).
  2938. The associated value is a reference on a hash. The keys are:
  2939. @table @code
  2940. @item begin
  2941. The @code{begin} should lead to the beginning of the
  2942. formatted output.
  2943. @item end
  2944. The @code{end} should lead to the end of the
  2945. formatted output.
  2946. @item class
  2947. The HTML class. If not defined, the command name.
  2948. @item pre_style
  2949. The preformatted style. If not defined the corresponding @acronym{CSS} style
  2950. is used.
  2951. @item style
  2952. If the associated value is @code{code}, the format is assumed to be in
  2953. code style, where
  2954. with @samp{---}, @samp{--}, @samp{''} and @samp{``} kept as is.
  2955. If the key is absent the format inherits the code style
  2956. and the font from the enclosing context.
  2957. @end table
  2958. The enclosed text will be formatted as described in
  2959. @ref{Paragraph and preformatted region}, and the name of the complex
  2960. format will be available to the function formatting the text.
  2961. If you aren't satisfied with this scheme, you can redefine the following
  2962. function reference for a better control over the complex format formatting:
  2963. @deftypefn {Function Reference} $complex_format_text complex_format $format_name $preformatted_text
  2964. @var{$format_name} is the complex format name, @var{$preformatted_text} is the
  2965. text allready formatted as described in @ref{Paragraph and preformatted region}.
  2966. This function returns the whole complex format.
  2967. @end deftypefn
  2968. @node Other block commands formatting
  2969. @subsection Formatting of other block commands (@code{@@verbatim}, @code{@@cartouche}, @code{@@quotation}, @code{@@html})
  2970. @c FIXME verbatiminclude is distinct
  2971. Regions corresponding with raw text, like @code{@@verbatim}, @code{@@html},
  2972. @code{@@tex} or the content of the file given in @code{@@verbatiminclude}
  2973. argument are formatted according to the following function reference:
  2974. @deftypefn {Function Reference} $raw_region raw $command $text
  2975. @var{$command} is the command name, @var{$text} is the raw text.
  2976. In the default case, if @var{$command} is @code{verbatiminclude}
  2977. the text is the content of the @code{@@verbatiminclude} file argument.
  2978. @end deftypefn
  2979. If La@TeX{}2HTML is used, @code{@@tex} regions are handled differently,
  2980. (@pxref{Init File Formatting of Commands}).
  2981. The @code{@@cartouche} command formatting is controlled by the
  2982. function reference:
  2983. @deftypefn {Function Reference} $cartouche cartouche $text
  2984. @var{$text} is the text appearing within the cartouche.
  2985. @end deftypefn
  2986. The formatting of @code{@@quotation} and @code{@@smallquotation}
  2987. is controlled by two function references.
  2988. The first one is usefull in case the @code{@@quotation} has an argument, as
  2989. it allows to prepend a string to the quotation text:
  2990. @deftypefn {Function Reference} $prepended_string quotation_prepend_text $command $text
  2991. @var{$command} is the @@-command.
  2992. @var{$text} is the argument of the quotation with @@-commands not
  2993. interpreted. This function
  2994. can return a string which will be prepended to the quotation text.
  2995. @end deftypefn
  2996. The whole quotation is formatted by:
  2997. @deftypefn {Function Reference} $quotation quotation $command $quotation_text $argument_text $argument_text_texi \@@quote_authors
  2998. @var{$command} is the @@-command.
  2999. @var{$quotation_text} is the quotation text, formatted, with the text
  3000. prepended by the function above. @var{$argument_text} is the argument
  3001. of the @code{@@quotation}, formatted. @var{$argument_text_texi} is the argument
  3002. of the @code{@@quotation}, simply formatted.
  3003. @var{\@@quote_authors} is a reference on an array holding information
  3004. about the @code{@@author} command arguments appearing within the
  3005. @code{@@quotation}. Each of the array element is a reference on a
  3006. hash with the following keys:
  3007. @table @code
  3008. @item author_texi
  3009. Texinfo code of this @code{@@author} line.
  3010. @item author_text
  3011. Formatted argument of the @code{@@author} line.
  3012. @end table
  3013. @end deftypefn
  3014. @node Paragraph and preformatted region
  3015. @section Formatting of paragraph and preformatted regions
  3016. @c FIXME not sure that it is stable enough to be documented?
  3017. If defined, the following function reference is called at the paragraph
  3018. opening:
  3019. @deffn {Function Reference} begin_paragraph_texi $paragraph_or_preformatted \@@paragraph_at_commands $context_command \%state \@@stack
  3020. @var{$paragraph_or_preformatted} is @samp{paragraph} when opening a paragraph,
  3021. or @samp{preformatted} at the beginning of a preformatted region.
  3022. @var{\@@paragraph_at_commands} is a reference on an array containing the
  3023. listof th ecommands with brace opened outside of the paragraph or
  3024. preformatted. @var{$context_command} is a reference on a structure describing
  3025. in what generalized block @@-command we are.
  3026. @var{\%state} holds informations about the current context.
  3027. @var{\@@stack} is an opaque variable.
  3028. @end deffn
  3029. @menu
  3030. * Paragraph and preformatted formatting::
  3031. * Avoiding paragraphs::
  3032. @end menu
  3033. @node Paragraph and preformatted formatting
  3034. @subsection Paragraph and preformatted region formatting
  3035. The formatting of a paragraph region or a preformatted region, is controlled
  3036. by function references:
  3037. @deftypefn {Function Reference} $paragraph_text paragraph $text $alignement $index $formatting_command $formatting_command_formatted \$paragraph_number $format $item_number $enumerate_style $number $command_stack_at_end $command_stack_at_begin
  3038. This function formats a paragraph. @var{$text} is the text of the paragraph,
  3039. @var{$alignement} is the empty string when no alignement command has
  3040. been seen, otherwise it is the current alignement command name (see
  3041. the previous section).
  3042. @var{$indent} holds @samp{noindent} or @samp{indent} if the corresponding
  3043. @@-command appeared in the paragraph.
  3044. @var{$command_stack_at_end} and @var{$command_stack_at_begin} are arrays
  3045. containing the opened @@-commands at end and at beginning of the paragraph,
  3046. latest on top.
  3047. The remaining arguments are usefull when the paragraph appears within a
  3048. list or table. It is usefull whenever the paragraph has to be formatted
  3049. differently when appearing in such environments.
  3050. Moreover in that case the format command (@code{@@itemize}@dots{})
  3051. may have an associated formatting command.
  3052. @var{$formatting_command} is this formatting command
  3053. (like @code{@@minus}).
  3054. @var{$formatting_command_formatted} is the command formatted in html
  3055. in case the formatting command is a leading command (like @code{@@minus})
  3056. which should be leading the first paragraph.
  3057. @var{\$paragraph_number} is a reference on the number of
  3058. paragraphs in that format command. The corresponding variable should be
  3059. increased when a paragraph is added. @var{$format} is the format command.
  3060. @xref{Table and list items formatting}.
  3061. If the @var{$format} is an enumerate, @var{$item_number} is the number of
  3062. the item in the list, @var{$enumerate_style} is the argument of the enumerate,
  3063. @var{$number} is the number or letter corresponding with this item.
  3064. @end deftypefn
  3065. @deftypefn {Function Reference} $preformatted_text preformatted $text $style $region_name $formatting_command $formatting_command_formatted \$preformatted_number $format $item_number $enumerate_style $number $command_stack_at_end $command_stack_at_begin
  3066. This function formats a preformatted region. @var{$text} is the text of the
  3067. preformatted region, @var{$style} is the css style associated with that
  3068. preformatted region (@pxref{Customizing CSS}). @var{$region_name} is the
  3069. name of the command opening
  3070. the preformatted region (@code{example}@dots{}, see @ref{Preformatted block command formatting})
  3071. or a identifier for the preformatted context (for example
  3072. @code{menu-comment}, see @ref{Menu formatting}).
  3073. The alignment commands are not taken into account, as the spaces are
  3074. preserved in preformatted regions, you should flush and center by hand.
  3075. @var{$command_stack_at_end} and @var{$command_stack_at_begin} are arrays
  3076. containing the opened @@-commands at end and at beginning of the preformatted
  3077. region, latest on top.
  3078. The remaining arguments are usefull when the preformatted region appears
  3079. within a list or table. It is usefull whenever the preformatted region
  3080. has to be formatted
  3081. differently when appearing in such environments.
  3082. Moreover in that case the format command (@code{@@itemize}@dots{})
  3083. may have
  3084. an associated formatting command.
  3085. @var{$formatting_command} is this formatting command
  3086. (like @code{@@minus}).
  3087. @var{$formatting_command_formatted} is the command formatted in html
  3088. in case the formatting command is a leading command (like @code{@@minus})
  3089. which should be leading the first preformatted region.
  3090. @var{\$preformatted_number} is a reference on the number of
  3091. preformatted regions in that format command. The corresponding variable
  3092. should be increased when a preformatted region is added. @var{$format} is the
  3093. format command.
  3094. @xref{Table and list items formatting}.
  3095. If the @var{$format} is an enumerate, @var{$item_number} is the number of
  3096. the item in the list, @var{$enumerate_style} is the argument of the enumerate,
  3097. @var{$number} is the number or letter corresponding with this item.
  3098. @end deftypefn
  3099. A special function reference is called instead if the preformatted
  3100. is empty and the function reference is defined:
  3101. @deftypefn {Function Reference} $preformatted_text empty_preformatted $text
  3102. @var{$text} is the text of th epreformatted which should contain only
  3103. spaces. The function refernece should return the formatted text for
  3104. this empty preformatted region.
  3105. @end deftypefn
  3106. @node Avoiding paragraphs
  3107. @subsection Avoiding paragraphs in @@-commands
  3108. @cindex Avoid paragraph opening
  3109. @vindex %format_in_paragraph
  3110. It is possible to avoid that a format closes the previous paragraph or
  3111. preformatted region and reopens one, by putting the format command in a
  3112. hash, @code{%format_in_paragraph} with a true value. This only
  3113. makes sense for few commands since otherwise the nesting of formats and
  3114. paragraphs could become wrong.
  3115. @vindex %no_paragraph_commands
  3116. If the value of @code{%no_paragraph_commands} associated with a command is
  3117. true, no paragraph is started by the command if outside of a paragraph
  3118. (after an empty line, for example). If the value is set to 0, it will start
  3119. a paragraph. If the value is not set, reasonable defaults are
  3120. set.
  3121. @vindex %stop_paragraph_command
  3122. It is also possible to stop a paragraph when an @@-command happens by
  3123. putting the @@-command in the @code{%stop_paragraph_command} hash
  3124. associated with a true value.
  3125. @node Lists tables and definitions formatting
  3126. @section Lists, tables and definitions formatting
  3127. @menu
  3128. * Lists and tables formatting::
  3129. * Definition formatting::
  3130. @end menu
  3131. @node Lists and tables formatting
  3132. @subsection Customizing the formatting of lists and tables
  3133. The formatting of lists and tables is done at two levels:
  3134. @itemize
  3135. @item
  3136. At the level of the whole region (table or list),
  3137. @item
  3138. At the level of the individual items, rows or cells of the list or table.
  3139. @end itemize
  3140. @menu
  3141. * Table and list items formatting::
  3142. * Whole table and list formatting::
  3143. @end menu
  3144. @node Table and list items formatting
  3145. @subsubsection Formatting individual table and list items
  3146. In texinfo it is possible to give @code{@@itemize} or table command (hereafter
  3147. called a @dfn{format command}) a @dfn{formatting command}.
  3148. For example @code{@@minus} is the formatting command here:
  3149. @example
  3150. @@table @@minus
  3151. @end example
  3152. @vindex %special_list_commands
  3153. The default is to apply the command to the text item, however it is possible
  3154. to avoid it.
  3155. The hash @code{%special_list_commands} has an entry for each of the
  3156. format command. Each of these entries is a hash reference. If a formatting
  3157. command is a key of the hash reference, then the formatting command is not
  3158. applied to the text item for that format command. For example, if we have:
  3159. @example
  3160. $special_list_commands@{'itemize'@} = @{ 'bullet' => '' @};
  3161. @end example
  3162. and we have the following @code{@@itemize}:
  3163. @example
  3164. @@itemize @@bullet
  3165. @@item an item
  3166. @@end itemize
  3167. @end example
  3168. then @code{@@bullet} will not be applied to @code{an item}.
  3169. Every time a @code{@@tab} or an @code{@@item} is encountered, the following
  3170. function reference is called, if defined:
  3171. @deftypefn {Function Reference} $result_line tab_item_texi $command \@@command_stack \@@stack \%state $line $line_nr
  3172. @var{$command} is the command name.
  3173. @var{\@@command_stack} is an array with all the @@-commands opened, latest
  3174. on top.
  3175. @var{\@@stack} is an opaque variable.
  3176. @var{\%state} holds informations about the current context.
  3177. @var{$line} is the line appearing after the command.
  3178. @var{$line_nr}
  3179. is an opaque structure containing the information about the line number of the
  3180. @@-command.
  3181. The function returns the line that may be further processed.
  3182. @end deftypefn
  3183. More control of the text before formatting of the line or the item is
  3184. achieved with the following function reference:
  3185. @deftypefn {Function Reference} ($result_line, $open_command) format_list_item_texi $format $line $prepended $command $number
  3186. The @var{$format} is the list or table @@-command,
  3187. @var{$line} is the item line, @var{$command} is the @dfn{format command},
  3188. @var{$prepended} is set to the text folllowing the @dfn{format command}
  3189. on the format argument line.
  3190. The @var{$number} is the number of the item, as set in @code{@@enumerate}.
  3191. The @var{$result_line} replaces the item argument.
  3192. @var{$open_command} is an obsolete return code that can be set to
  3193. anything.
  3194. @end deftypefn
  3195. Then the different @@-commands items are formatted thanks to
  3196. function references:
  3197. @table @strong
  3198. @item lists
  3199. The items of lists are formatted using the following function reference:
  3200. @deftypefn {Function Reference} $list_item list_item $text $format $command $formatted_command $item_number $enumerate_style $number $prepended_texi $prepended_formatted $only_inter_item_commands $before_items $item_command
  3201. This function formats the text between @code{@@item} commands. @var{$text}
  3202. is the text corresponding with the item. @var{$format} is the type of format,
  3203. @samp{itemize} or @samp{enumerate}. @var{$command} is the formatting command
  3204. given in argument to @code{@@itemize}, @var{$formatted_command} is this command
  3205. formatted if it is a leading command, like @code{@@minus}.
  3206. If the @var{$format} is an enumerate, @var{$item_number} is the number of
  3207. the item in the list, @var{$enumerate_style} is the argument of the enumerate,
  3208. @var{$number} is the number or letter corresponding with this item.
  3209. If the @var{$format} is an itemize, @var{$prepended_texi} is the text that
  3210. appeared on the itemize line, maybe after the formatting command
  3211. (if any), and @var{$prepended_formatted} is the corresponding text,
  3212. formatted.
  3213. @var{$only_inter_item_commands} is true if there are only @@-commands
  3214. that are not considered as the item argument in the item, like
  3215. index entries.
  3216. @var{$before_items} is set if there is in fact no leading @code{@@item}
  3217. for the text, as it may happen for some text following the @var{$format}
  3218. @@-command, as in
  3219. @example
  3220. @@table @@asis
  3221. Tex before items.
  3222. @end example
  3223. @var{$item_command} is the item command name.
  3224. @end deftypefn
  3225. @item two column tables
  3226. The two columns tables (@code{@@table}, @code{@@ftable} and @code{@@vtable}),
  3227. items are formatted using two function references,
  3228. one for the first line located on the @code{@@item} line corresponding
  3229. with the first column, the other for the text appearing on the
  3230. following lines, corresponding with the second column text.
  3231. @deftypefn {Function Reference} $table_item table_item $item_text $index_label_text $format $command \@@command_stack $item_command $formatted_index_entry
  3232. This function is used to format the text on the @code{@@item} line.
  3233. @var{$item_text} is the text line. In case there is an index entry
  3234. associated with the @code{@@item} (as with @code{@@ftable} and
  3235. @code{@@vtable}), @var{$index_label_text} is the text inserted at
  3236. the place where an index entry appears. @xref{Index entry place formatting}.
  3237. @var{$format} is the type of format,
  3238. @samp{table}, @samp{ftable} or @samp{vtable}. @var{$command} is the formatting command
  3239. given in argument to the table format command.
  3240. @var{\@@command_stack} is an array with all the @@-commands opened, latest
  3241. on top.
  3242. @var{$item_command} is the item command, @samp{@@item} or @samp{@@itemx}.
  3243. @var{$formatted_index_entry} is the index entry formatted.
  3244. @end deftypefn
  3245. @deftypefn {Function Reference} $table_line table_line $text
  3246. This function is used to format the text on the lines following
  3247. the @code{@@item} line. @var{$text} is the corresponding text.
  3248. @end deftypefn
  3249. @item multitable
  3250. @anchor{Multitable Formatting}
  3251. The multitable elements formatting is controlled by the functions associated
  3252. with two function references. One for a cell, and the other for a row.
  3253. @deftypefn {Function Reference} $multitable_cell cell $text $item_command \@@columnfractions \@@prototype_row \@@prototype_lengths $column_number
  3254. This function is used to format the text of a multitable cell, the text
  3255. following a @code{@@item} or a @code{@@tab}.
  3256. @var{$text} is the corresponding text. @var{$item_command} is the command
  3257. used to introduce the row, such that it is possible to distinguish
  3258. between @code{@@item} and @code{@@headitem}.
  3259. @var{\@@columnfractions} is a reference on an array
  3260. containing the @code{@@columnfraction} arguments, if any, and
  3261. @var{\@@prototype_row} is a reference on an array containing the row prototypes
  3262. given on the @code{@@multitable} line, if any.
  3263. @var{\@@prototype_lengths} array contains the lengths of the row prototypes
  3264. formatted.
  3265. @var{$column_number} is the maximal number of columns.
  3266. @end deftypefn
  3267. @deftypefn {Function Reference} $multitable_row row $text $item_command \@@columnfractions \@@prototype_row \@@prototype_lengths $column_number
  3268. This function is used to format a multitable row. @var{$text} is
  3269. the row text, with cells allready formatted with the @code{$cell}
  3270. function reference. @var{$item_command}, @var{\@@columnfractions},
  3271. @var{\@@prototype_row}, @var{\@@prototype_lengths}
  3272. and @var{$column_number} are the same than in the function reference above.
  3273. @end deftypefn
  3274. @end table
  3275. By default, this function is interlinked with
  3276. @code{$begin_format_texi} (@pxref{Init File General Block Commands})
  3277. and @code{@@multitable} formatting since a stack of possibly nested
  3278. multitables is stored in order to know the cell number.
  3279. @node Whole table and list formatting
  3280. @subsubsection Formatting of a whole table or list
  3281. @vindex %format_map
  3282. If the Texinfo command is a key of the @code{%format_map}, the associated
  3283. value is used to specify the formatting of the construct, otherwise a function
  3284. is called.
  3285. The value in @code{%format_map} associated with a command is interpreted
  3286. similarly with values associated with more simpler commands:
  3287. @itemize
  3288. @item
  3289. If the text is a word, in HTML or XML, it is considered to be an XML
  3290. or HTML element
  3291. name, and the whole table or list is enclosed between the element opening
  3292. and the element closing.
  3293. @item
  3294. If the text is a word followed by some text,
  3295. the word and is interpreted as above, and the
  3296. text is considered to be the attributes text of the element.
  3297. @item
  3298. If the text is empty nothing is added to the text.
  3299. @end itemize
  3300. In case the @code{%format_map} isn't used, a function reference called
  3301. @code{$table_list}
  3302. should be redefined, the associated function will be called each time
  3303. a command isn't found in @code{%format_map}.
  3304. @deftypefn {Function Reference} $whole_table_list table_list $format_command $text $command $formatted_command $item_nr $enumerate_style $prepended_texi $prepended_formatted \@@columnfractions \@@prototype_row \@@prototype_lengths $column_number
  3305. @var{$format_command} is the Texinfo command name, @var{$text} is the
  3306. formatted items. @var{$command} is the @dfn{format command} given in argument
  3307. to the format command, @var{$formatted_command} is the same, but formatted.
  3308. @var{$prepended_texi} is the remaining text on the format command line,
  3309. @var{$prepended_formatted} is the same, but formatted.
  3310. Only relevant in @code{@@enumerate}, @var{$item_nr} is the item number, and
  3311. @var{$enumerate_style} is the @code{@@enumerate} style. Only relevant in
  3312. @code{@@multitable}
  3313. @var{\@@columnfractions} is a reference on an array
  3314. containing the @code{@@columnfraction} arguments, if any,
  3315. @var{\@@prototype_row} is a reference on an array containing the row prototypes
  3316. given on the @code{@@multitable} line, if any,
  3317. @var{\@@prototype_lengths} array contains the lengths of the row prototypes
  3318. formatted and
  3319. @var{$column_number} is the maximal number of columns.
  3320. @end deftypefn
  3321. If you still want to use @code{%format_map} but differently from
  3322. the default, it is possible to redefine the following function reference:
  3323. @deftypefn {Function Reference} $whole_table_list format $command $format $text
  3324. @var{$command} is the @@-command, @var{$format} is the entry associated with
  3325. @var{$command} in @code{%format_map}. @var{$text} is the formatted items.
  3326. @end deftypefn
  3327. @node Definition formatting
  3328. @subsection Interpretation and formatting of the definition formatting
  3329. The formatting of definition commands is controlled by a main hash,
  3330. 3 strings and another hash, and and five
  3331. functions. The main hash describes how the text on the definition line is
  3332. interpreted, the functions control the formatting of the definition line
  3333. and the definition function text.
  3334. @menu
  3335. * Definition line interpretation::
  3336. * Definition command formatting::
  3337. @end menu
  3338. @node Definition line interpretation
  3339. @subsubsection Customizing the interpretation of a definition line
  3340. @vindex %def_map
  3341. The keys of the hash @code{%def_map} are definition command names.
  3342. There are two types of entries:
  3343. @itemize
  3344. @item If the command is a shortcut for
  3345. another definition command the value is a text and the definition
  3346. command is replaced by the text.
  3347. For example if we have:
  3348. @example
  3349. $def_map@{'deftruc'@} = '@@defvr @{A truc@}';
  3350. @end example
  3351. and a line like
  3352. @example
  3353. @@deftruc var
  3354. @end example
  3355. the line will be transformed in
  3356. @example
  3357. @@defvr @{A truc@} var
  3358. @end example
  3359. @item
  3360. If the command is not a shortcut, it is associated with an array
  3361. reference. The first element is @samp{f}, @samp{v} or @samp{t} corresponding
  3362. with the index type (@samp{f} for function, @samp{v} for variable,
  3363. @samp{t} for type).
  3364. The remaining of the array describes how to interpret the text following
  3365. the definition command on the definition command line.
  3366. The entry item specify what corresponds
  3367. with the next bracketed item or word. Currently the possibilities are
  3368. @samp{category}, @samp{name}, @samp{type}, @samp{class}, @samp{arg}
  3369. and @samp{argtype}. @samp{arg} means that the arguments are not mixed
  3370. with type definitions, with @samp{argtype} types are mixed with
  3371. definitions. When there is no @samp{arg} nor @samp{argtype} it is
  3372. the same than @samp{argtype}.
  3373. For example if we have
  3374. @example
  3375. def_map@{'defvr'@} = [ 'v', 'category', 'name' ];
  3376. @end example
  3377. The first bracketed item following @code{@@defvr} is considered
  3378. to be the category and the next one is the name. The index associated
  3379. with the definition line is the variables index.
  3380. @end itemize
  3381. Some characters are special with regard with definition parsing, they
  3382. are delimiters, the can have a role in definition argument determination,
  3383. and also hae a special meaning in arguments parsing.
  3384. This is not very well documented in the Texinfo manual,
  3385. so it is subject to change. Strings allow to determine the delimiters:
  3386. @vtable @code
  3387. @item $def_argument_separator_delimiters
  3388. Characters that separate arguments, currently @code{()[],}.
  3389. @item $def_always_delimiters
  3390. Character that are always delimiters, if they appear in a type or a
  3391. parameter,
  3392. @code{()[]}.
  3393. @item $def_in_type_delimiters
  3394. Character that are considered as delimiters only if in a type. In
  3395. a parameter they are part of the parameter.
  3396. @end vtable
  3397. @node Definition command formatting
  3398. @subsubsection Customization of the definition formatting
  3399. Five functions are used when formatting a definition command:
  3400. @table @strong
  3401. @item category name
  3402. @deftypefn {Function Reference} $category definition_category $category $class $style $command
  3403. This function precise a category name associating a class
  3404. @var{$class} (if given) with @var{$category}. The @var{$style} of the
  3405. definition may be @samp{f}, for function, @samp{v}, for variable or @samp{t},
  3406. for type. The @var{$command} is the definition @@-command.
  3407. @end deftypefn
  3408. @deftypefn {Function Reference} $entry definition_index_entry $name $class $style $command
  3409. This function precise a name associating a class
  3410. @var{$class} (if given) with @var{$name}. This is used to do an index
  3411. entry associated with th edefinition command. The @var{$style} of the
  3412. definition may be @samp{f}, for function, @samp{v}, for variable or @samp{t},
  3413. for type. The @var{$command} is the definition @@-command.
  3414. @end deftypefn
  3415. @item formatting of the definition line
  3416. @deftypefn {Function Reference} $line def_line $class_category_class $name $type $arguments $index_label \@@arguments_array \@@arguments_type_array \@@unformatted_arguments_array $command $class_name $category $class $style $original_command
  3417. This function formats the definition line. @var{$class_category} is the
  3418. category
  3419. formatted with @code{$definition_category}, @var{$name}, @var{$type} and
  3420. @var{arguments} are the element of the definition line. @var{$index_label} is
  3421. the text inserted at the place where an index entry appears.
  3422. @xref{Index entry place formatting}.
  3423. @var{\@@arguments_array} is an array holding the definition arguments,
  3424. formatted. @var{\@@arguments_type_array} holds the type of the definition
  3425. arguments, like @samp{name}, @samp{type} and similar arguments,
  3426. @samp{paramtype}.
  3427. @samp{delimiter} and @samp{param}. @var{\@@unformatted_arguments_array}
  3428. holds the arguments without @@-command substitution. @var{$command} is the
  3429. definition command, after substitution.
  3430. @var{$class_name} is the class applied on name, formatted
  3431. as specified in @code{definition_index_entry}. @var{$category} and
  3432. @var{$class} are the corresponding arguments. @var{$style} corresponds
  3433. with the index style, as explained above. @var{$original_command} is the
  3434. unmodified definition @@-command.
  3435. @end deftypefn
  3436. @item definition text
  3437. @deftypefn {Function Reference} $definition_text def_item $text $only_inter_item_commands $command
  3438. This function formats the definition text, @var{$text}.
  3439. @var{$only_inter_item_commands} is true if there are only @@-commands
  3440. that are not considered as the definition argument in the definition
  3441. text, like index entries.
  3442. @var{$command} is the definition @@-command.
  3443. @end deftypefn
  3444. @item the whole definition
  3445. @deftypefn {Function Reference} $definition def $text $command
  3446. This function formats the whole definition. The definition line and text
  3447. formatted by the above functions are in @var{$text}.
  3448. @var{$command} is the definition @@-command.
  3449. @end deftypefn
  3450. @end table
  3451. @node Menus indices and floats formatting
  3452. @section Menus, indices and floats formatting
  3453. @menu
  3454. * Menu formatting::
  3455. * Indices formatting::
  3456. * Floats and lists of floats formatting::
  3457. @end menu
  3458. @node Menu formatting
  3459. @subsection Menu formatting
  3460. There are two possibilities for menu formatting:
  3461. @itemize @bullet
  3462. @item format the whole menu in a preformatted environment, like
  3463. in @ref{Preformatted block command formatting};
  3464. @item format the menu in table with more specialized formatting for each
  3465. part of the menu;
  3466. @end itemize
  3467. The simple formatting in a preformatted is used if
  3468. the configuration variable @code{SIMPLE_MENU} is true,
  3469. otherwise the format with tables is used (this is the default).
  3470. In HTML, if the configuration variable @code{USE_ACCESSKEY} is set,
  3471. the @code{accesskey} attribute is used in anchors. In that case the
  3472. @code{%BUTTONS_ACCESSKEY} hash is used for the access key.
  3473. In @command{texi2any}, a menu is considered to be composed of 2 parts, the
  3474. @dfn{menu entries} and the @dfn{menu comments} (@pxref{Writing a Menu}).
  3475. Menu entries are further
  3476. divided in an @dfn{entry link} and optionnaly an @dfn{entry description}.
  3477. The entry link consists in a node name and an optional menu entry
  3478. name (@pxref{Menu Parts}).
  3479. @menu
  3480. * Menu components formatting::
  3481. * Simple menu formatting:: formatting of a whole menu in a simple
  3482. preformatted environement
  3483. * Table menu formatting:: formatting of a whole menu in a
  3484. table environment
  3485. @end menu
  3486. @node Menu components formatting
  3487. @subsubsection The formatting of the different menu components
  3488. If in a preformatted context (and @code{SIMPLE_MENU} isn't set), the
  3489. menu link and description are put in the same preformatted environment.
  3490. This can be avoided with the configuration variable
  3491. @code{SEPARATE_DESCRIPTION}.
  3492. Two function references are associated with the formatting of the
  3493. different parts of a menu:
  3494. @deftypefn {Function Reference} $link menu_link $section \%state $href $node $name $ending $has_name \@@command_stack $preformatted $node_normalized_formatted
  3495. @var{$section} is the section name corresponding with the link, @var{$href}
  3496. is the link hypertextual reference. @var{$href} may be absent.
  3497. @var{\%state} holds informations about the current context.
  3498. @var{$node} is the node name, @var{$name} is the
  3499. name of the node. @var{$ending} is the text ending the link entry,
  3500. in general @samp{::} followed by some spaces.
  3501. @var{$has_name} is true if the entry has an explicit name, otherwise
  3502. @var{$name} has been constructed using the formatted node name.
  3503. @var{\@@command_stack} is an array containing the commands enclosing
  3504. the menu link. It is used in the default case to detect if the
  3505. menu link is right in the @command{@@menu} or not, since if it is not
  3506. right below the menu the formatting is simpler.
  3507. @var{$preformatted} is true if in preformatted context.
  3508. @xref{Init File Expansion Contexts}.
  3509. @var{$node_normalized_formatted} is the node with spaces normalized
  3510. and formatted.
  3511. @end deftypefn
  3512. This command is not called if @code{SIMPLE_MENU} is set.
  3513. @deftypefn {Function Reference} $description menu_description $description_text \%state $element_text
  3514. @var{$description_text} is the text of the menu description.
  3515. The formatted link is also here if in preformatted context and
  3516. @code{SEPARATE_DESCRIPTION} is not set.
  3517. @var{\%state}
  3518. should be used similarly than for the menu link. @var{$element_text}
  3519. is the heading of the element associated with the node.
  3520. @var{$command_stack} and @var{$preformatted} are the same than for the
  3521. menu link.
  3522. @end deftypefn
  3523. The @dfn{menu comment} part is formatted like a normal command,
  3524. called @code{menu_comment}. It is only used if not in preformatted
  3525. environment.
  3526. The default is to have it be formatted
  3527. like a @ref{Preformatted block command formatting}, with
  3528. @example
  3529. $complex_format_map@{'menu_comment'@} =
  3530. @{
  3531. 'begin' => "<tr><th colspan=\"3\" align=\"left\" valign=\"top\">",
  3532. 'end' => "</th></tr>", 'class' => 'menu-comment',
  3533. @}
  3534. @end example
  3535. @node Simple menu formatting
  3536. @subsubsection Simple menu formatting in a preformatted environment
  3537. If the menu is to be formatted in a single preformatted environment,
  3538. an entry for @samp{menu} and @samp{detailmenu}
  3539. should be added to the @code{%complex_format_map}
  3540. hash (@pxref{Preformatted block command formatting}).
  3541. In the default case, if the user didn't add an entry himself, a very simple
  3542. entry is used, with:
  3543. @example
  3544. $complex_format_map->@{'menu'@} = @{ 'begin' => '' , 'end' => '',
  3545. 'class' => 'menu-preformatted' @};
  3546. @end example
  3547. @node Table menu formatting
  3548. @subsubsection The formatting of the menu in a table
  3549. In the default case, the name of the section corresponding with the
  3550. node is used instead of the node name. If the configuration
  3551. variable @code{NODE_NAME_IN_MENU} is
  3552. true, however, node names are used. If the configuration variable
  3553. @code{AVOID_MENU_REDUNDANCY}
  3554. is true and menu entry equal menu description the description is not printed.
  3555. This is the default. Likewise, if node or section name equal entry name,
  3556. do not print entry name.
  3557. @vindex $MENU_SYMBOL
  3558. @vindex $UNNUMBERED_SYMBOL_IN_MENU
  3559. A symbol, @code{$MENU_SYMBOL} is put at the beginning of menu entries
  3560. when the node name is used. The default is @samp{&bull;} for HTML, @samp{*}
  3561. for text formats.
  3562. If @code{$UNNUMBERED_SYMBOL_IN_MENU} is true it is
  3563. also put at the beginning of unnumbered section names (in HTML). This is not
  3564. done by default.
  3565. @vindex $MENU_PRE_STYLE
  3566. @vindex $MENU_PRE_COMPLEX_FORMAT
  3567. The menu comments are considered to be preformatted text. The style
  3568. associated with this preformatted text is determined by
  3569. @code{$MENU_PRE_STYLE}. Default is @samp{font-family: serif}.
  3570. The entry similar with an entry in @code{%complex_format_map}
  3571. (@pxref{Preformatted block command formatting}) used when the menu
  3572. appears in a preformatted
  3573. enviroment is in
  3574. @code{$MENU_PRE_COMPLEX_FORMAT}, and, in the default case is:
  3575. @example
  3576. $MENU_PRE_COMPLEX_FORMAT = @{
  3577. 'pre_style' => $MENU_PRE_STYLE,
  3578. 'class' => 'menu-preformatted'
  3579. @};
  3580. @end example
  3581. The CSS class associated with menu comments is @code{menu-comments}.
  3582. The following function reference controls the formatting of a wole menu
  3583. or a detailmenu in that case:
  3584. @deftypefn {Function Reference} $menu menu_command $command $menu_components_text
  3585. @var{$command} is the menu command, currently @samp{menu}, @samp{detailmenu}
  3586. or @samp{direntry}.
  3587. @var{$menu_components_text} is the formatted menu components text, obtained
  3588. as explained above.
  3589. @end deftypefn
  3590. @node Indices formatting
  3591. @subsection Indices formatting
  3592. Two different things needs to be handled for indices formatting, the place
  3593. where the index term appears, the index entry, and the index list itself.
  3594. The indexing commands like @code{@@cindex} determines where index entries
  3595. appear, and the index list is printed with a @code{@@printindex} command.
  3596. @menu
  3597. * Index entry place formatting:: Index entries in the main document are
  3598. targets for hypertext references
  3599. * Index list formatting:: Customizing the formatting of the index list
  3600. @end menu
  3601. @node Index entry place formatting
  3602. @subsubsection Formatting of index entries
  3603. Index entry places in the main text may be the target for
  3604. references. Their formatting
  3605. is controlled by the function associated with the following function
  3606. reference:
  3607. @deftypefn {Function Reference} $target index_entry_label $identifier $preformatted $entry $index_name $index_command $texi_entry $formatted_entry $in_region_not_in_output \%index_entry
  3608. @var{$identifier} should be used to create
  3609. a target for links (typically associated with a name or id
  3610. attribute in HTML).
  3611. @var{$preformatted} is true if the index entry appeared in preformatted text.
  3612. @var{$entry} is the index entry with all the @@-commands removed.
  3613. @var{$index_name} is the index name, @var{$command} is the index command which
  3614. may be a index command like @code{@@cindex}, but also a definition or
  3615. a table. @var{$texi_entry} is the index entry with @@-commands, and
  3616. @var{$formatted_entry} the entry formatted.
  3617. @var{$in_region_not_in_output} is set if the index entry appears in a region
  3618. formatting (for example @code{@@titlepage}) and not in the
  3619. output document.
  3620. @var{\%index_entry} is a reference on a hash holding informations about
  3621. the index entry.
  3622. @end deftypefn
  3623. Regular index entries are (like @code{@@cindex}) are
  3624. formatted using the following function reference:
  3625. @deftypefn {Function Reference} $index_entry index_entry_command $command $index_name $label $entry_texi $entry_formatted
  3626. @var{$command}, @var{$index_name}, @var{$entry_texi} and @var{$entry_formatted}
  3627. are the same as above, and @var{$label} is what could be used as a label,
  3628. formatted using the function above.
  3629. @end deftypefn
  3630. @node Index list formatting
  3631. @subsubsection Customizing the formatting of index lists
  3632. There is an elaborate default index formatting, with
  3633. index summary by letter linking to index entries grouped by letters too,
  3634. with the possibility of index pages split accross files. This system may be
  3635. completly bypassed by redefining the function reference that is called when
  3636. @code{@@printindex} is encountered:
  3637. @deftypefn {Function Reference} $index_text printindex $index_name \%printindex
  3638. @var{$index_name} is the index name appearing on the
  3639. @code{@@printindex} line.
  3640. @var{\%printindex} is a reference on a hash holding informations
  3641. on the index.
  3642. The index formatted should be returned by this function reference.
  3643. @end deftypefn
  3644. If the default index formatting is used, there are still possibilities
  3645. to customize part of the formatting.
  3646. The index entries are sorted alphabetically. A whole index list is
  3647. considered to be composed of letter entries. A letter entry is composed
  3648. by all the index entries beginning with that letter. A letter may
  3649. be a non alphabetical character, but we call it letter here.
  3650. An index summary appears at the beginning and at the end of an index list,
  3651. and should be used to jump directly to a letter entry. Indices lists
  3652. may be split across pages, thus the different letters may appear on different
  3653. files. The number of index entries appearing on each page is determined
  3654. by a configuration variable @code{SPLIT_INDEX}, if set. The default is not
  3655. to split indices.
  3656. The formatting of all these elements is controlled by the following
  3657. function references:
  3658. @table @emph
  3659. @item formatting of a letter in a summary
  3660. @deftypefn {Function Reference} {($result_letter, $identifier, $is_symbol)} summary_letter $letter $file $identifier $index_element_id $number $index_element $index_name
  3661. This function is used to format a letter appearing in a summary, refering
  3662. to a letter entry in the index list.
  3663. @var{$letter} is the letter. @var{$file} is the file name where the letter
  3664. entry appears. More precisely, it is empty when the letter entry is on the
  3665. same page than the summary, it contains the file name when the index page
  3666. is split accross page. @var{$identifier} is an identifier for the target
  3667. letter entry. @var{$index_element_id} is the identifier associated with the
  3668. element holding the letter. @var{$number} and @var{$index_element} are
  3669. not specified. @var{$index_name} is the name of the index.
  3670. The function returns the resulting letter @var{$result_letter}, an
  3671. identifier for the letter @var{$identifier}, to be used in anchors, for example
  3672. and @code{$is_symbol} should be true if the letter is not a regular letter
  3673. but a symbol.
  3674. @end deftypefn
  3675. @item formatting of a summary
  3676. @deftypefn {Function Reference} $summary index_summary \@@alphabetical_letters \@@nonalphabetical_letters
  3677. @var{\@@alphabetical_letters} and @var{\@@nonalphabetical_letters} contain the
  3678. formatted summary letters, formatted with the above function.
  3679. @end deftypefn
  3680. @item formatting of an index entry
  3681. @deftypefn {Function Reference} $entry index_entry $entry_href $entry_text $element_href $element_heading $entry_file $element_file $entry_target $entry_element_target $in_region_not_in_output \%index_entry
  3682. @var{$entry_href} is a reference to the place where the index entry
  3683. appeared, @var{$entry_text} is the corresponding text. @var{$element_href}
  3684. is a reference to the beginning of the element containing
  3685. the index entry, @var{$element_heading} is the heading of the element.
  3686. @var{$entry_file} is the file where the index entry appear, while
  3687. @var{$element_file} is the file of the element. @var{$entry_target} is the
  3688. target of the index entry, @var{$entry_element_target} is the
  3689. element target.
  3690. @var{$in_region_not_in_output} is set if the index entry appears in a region
  3691. formatting (for example @code{@@titlepage}) and not in the
  3692. output document.
  3693. @var{\%index_entry} is a reference on a hash holding informations about
  3694. the index entry.
  3695. @end deftypefn
  3696. @item formatting of letter entry
  3697. @deftypefn {Function Reference} $letter_entry index_letter $letter $identifier $index_entries_text
  3698. This function formats a letter entry, consisting in all the index entries
  3699. beginning with this letter. @var{$letter} is the letter, @var{$identifier}
  3700. should be used to create a target for links (typically links from summaries),
  3701. and @var{$index_entries_text} is the text of the index entries formatted as
  3702. described above.
  3703. @end deftypefn
  3704. @item formatting of whole index
  3705. @deftypefn {Function Reference} $index print_index $index_text $index_name
  3706. @var{$index_text} is the text of all the index entries grouped by letter
  3707. appearing in that page formatted as above. It is undef if there are
  3708. no entries or theindex name isn't known. @var{index_name} is the name of
  3709. the index, the argument of @code{@@printindex}.
  3710. @end deftypefn
  3711. @end table
  3712. @node Floats and lists of floats formatting
  3713. @subsection Floats and lists of floats
  3714. Floats appear in the @code{@@float} environment, optionaly with a style
  3715. and a label, and with optionnal @code{@@caption} and @code{@@shortcaption}.
  3716. Their list appear after a @code{@@listoffloats}.
  3717. A hash reference is associated with each float, it is available in some
  3718. formatting functions. The keys are:
  3719. @table @code
  3720. @item caption_texi
  3721. @itemx shortcaption_texi
  3722. A reference on an array containing the caption or shortcaption lines,
  3723. with texi @@-commands.
  3724. @item style_texi
  3725. The style with texi @@-commands.
  3726. @item style_id
  3727. The unique identifier associated with the style.
  3728. @item style
  3729. The style formatted.
  3730. @item nr
  3731. The number with the same conventions than makeinfo (use the chapter number a
  3732. dot and then the number of the float of that style in the chapter, or an
  3733. absolute number if in unnumbered).
  3734. @item chapter_nr
  3735. The number of the chapter containing the float.
  3736. @item nr_in_chapter
  3737. The number of the float in the chapter.
  3738. @item absolut_nr
  3739. The number of the float in the document.
  3740. @item texi
  3741. The label with @@-commands.
  3742. @item name
  3743. The label formatted.
  3744. @item id
  3745. The unique identifier associated with the label. Usefull to make an anchor
  3746. or a reference.
  3747. @item target
  3748. The target that can be used to refer to that float.
  3749. @item element
  3750. A reference on a structure representing the element the float appear in.
  3751. @end table
  3752. @menu
  3753. * Float formatting:: Formatting of floats
  3754. * List of floats formatting:: Formatting the lists of floats
  3755. @end menu
  3756. @node Float formatting
  3757. @subsubsection Formatting a float
  3758. First there is an occasion to construct a texinfo text for the caption, using
  3759. the caption texinfo lines and the informations in the float structure.
  3760. The returned lines will be formatted in the main program. A function reference
  3761. is used here:
  3762. @deftypefn {Function Reference} {(\@@caption_lines_returned, \@@shortcaption_lines_returned)} caption_shortcaption \%float \@@caption_lines \@@shortcaption_lines
  3763. @var{\%float} is the structure defined above. @var{\@@caption_lines} and
  3764. @var{\@@shortcaption_lines} are references on arrays containing the
  3765. texinfo lines for caption and short caption. @var{\@@caption_lines_returned}
  3766. and @var{\@@shortcaption_lines_returned} are references on an array
  3767. containing the texinfo lines for the caption and shortcaption.
  3768. @end deftypefn
  3769. Then the float is formatted with the following function reference:
  3770. @deftypefn {Function Reference} $text float $float_text \%float $caption_text $shortcaption_text
  3771. @var{$float_text} is the text appearing within the @code{@@float}, formatted.
  3772. @var{\%float} is still the structure defined above. @var{$caption_text} and
  3773. @var{$shortcaption_text} are the caption and short caption build with the
  3774. above function and formatted.
  3775. @end deftypefn
  3776. It is also possible to do something when a caption or a shortcaption appear
  3777. with the following function reference:
  3778. @deftypefn {Function Reference} $text caption_shortcaption_command $command $formatted_caption \@@texi_lines \%float
  3779. @var{$command} is the @@-command, @samp{caption} or @samp{shortcaption}.
  3780. @var{$formatted_caption} is the caption text, formatted, while
  3781. @var{\@@texi_lines} is a reference on an array containing the caption lines,
  3782. this time without any formatting.
  3783. @var{\%float} is still the structure defined above.
  3784. In the default case this function reference returns an empty string.
  3785. @end deftypefn
  3786. @node List of floats formatting
  3787. @subsubsection Formatting lists of floats
  3788. A list of floats is introduced by @code{@@listoffloats}. The argument of
  3789. @code{@@listoffloats} is the @dfn{style}. First the style texinfo can be
  3790. modified with the following function reference:
  3791. @deftypefn {Function Reference} $style_texi_returned listoffloats_style $style_texi
  3792. @var{$style_texi} is the @code{@@listoffloats} argument with texinfo
  3793. @@-commands kept. It is possible to make changes to the @var{$style_texi} and
  3794. return a modified string, still with @@-commands. The modified string
  3795. is formatted in the main program.
  3796. @end deftypefn
  3797. After that, for each of the floats with that style, first there is a
  3798. possibility to modify the float style and the float caption before they
  3799. are formatted in the main program, with the following function references:
  3800. @deftypefn {Function Reference} $float_style_texi_returned listoffloats_float_style $style_texi \%float
  3801. @var{$style_texi} is the style, and @var{\%float} is the structure described
  3802. above. This function reference returns a style to be formatted in the
  3803. main program.
  3804. @end deftypefn
  3805. @deftypefn {Function Reference} (\@@caption_texi_returned, $caption_or_shortcaption) listoffloats_caption \%float
  3806. @var{\%float} is the structure described
  3807. above. This function reference returns a caption to be formatted in the
  3808. main program, @var{\@@caption_texi_returned}, and a string,
  3809. @var{$caption_or_shortcaption} that is either @samp{caption} or
  3810. @samp{shortcaption} that can be used by the main program if this information
  3811. is needed.
  3812. @end deftypefn
  3813. Each entry is formatted by:
  3814. @deftypefn {Function Reference} $listoffloats_entry listoffloats_entry $style_texi \%float $float_style $caption $href
  3815. @var{$style_texi} is the style with @@-commands, @var{$float_style} is the
  3816. style returned by the above function and formatted. @var{$caption} is the
  3817. caption returned by the above function formatted. @var{\%float} is the
  3818. structure corresponding with the float, and @var{$href} is an href pointing to
  3819. the float location.
  3820. @end deftypefn
  3821. Lastly, the whole @code{@@listoffloats} is formatted by:
  3822. @deftypefn {Function Reference} $listoffloats listoffloats $style_texi $style \@@listoffloats_entries
  3823. @var{$style_texi} is the style with @@-commands, @var{$style} is the
  3824. style returned by the above function and formatted. The array reference
  3825. @var{\@@listoffloats_entries} holds the entries formatted by the above
  3826. function.
  3827. @end deftypefn
  3828. @node Handling special regions
  3829. @section Handling special regions
  3830. @vindex %region_formats_kept
  3831. Special regions @code{@@titlepage}, @code{@@documentdescription} and
  3832. @code{@@copying} are removed from the document before the last pass in the
  3833. default case. They can be kept if the value associated with the @@-command
  3834. in the @code{%region_formats_kept} hash is true.
  3835. The following function reference is called when starting the
  3836. formatting of a special region, if defined:
  3837. @deffn {Function Reference} begin_special_region $region_name \%state \@@region_lines
  3838. @var{$region_name} is the region name.
  3839. @var{\%state} holds informations about the context of the region formatting.
  3840. @var{\@@region_lines} holds the region lines.
  3841. @end deffn
  3842. The following function reference is called when ending the formatting
  3843. of the special region, if defined:
  3844. @deftypefn {Function Reference} $formatting_result end_special_region $region_name \%state $formatted_region
  3845. @var{$region_name} is the region name.
  3846. @var{\%state} holds informations about the context of the region formatting.
  3847. @var{$formatted_region} is the result of the region formatting.
  3848. The function reference returns the result of the region formatting, after
  3849. possibly modifying it.
  3850. @end deftypefn
  3851. The @code{@@insertcopying} @@-command is formatted by
  3852. @deftypefn {Function Reference} $insertcopying insertcopying $text $comment $simple_text
  3853. @var{$text} is the text appearing in @code{@@copying}, formatted.
  3854. @var{$comment} is the text with texi removed, should be very simple
  3855. text.
  3856. @var{$simple_text} is the text formatted in string context
  3857. with minimal formatting but no elements.
  3858. @end deftypefn
  3859. The copying commane that is to be used at the beginning of output
  3860. files is formatted by
  3861. @deftypefn {Function Reference} $copying_comment_formatted copying_coment \@@copying_lines $text $comment $simple_text
  3862. @var{\@@copying_lines} is an array containing the Texinfo lines in @code{@@copying}.
  3863. @var{$text} is the text appearing in @code{@@copying}, formatted.
  3864. @var{$comment} is the text with texi removed, should be very simple
  3865. text.
  3866. @var{$simple_text} is the text formatted in string context
  3867. with minimal formatting but no elements.
  3868. @end deftypefn
  3869. @code{@@documentdescription} is handled by the following function
  3870. reference, that should set the configuration variable @code{documentdescription}:
  3871. @deffn {Function Reference} documentdescription \@@documentdescription_lines $text $comment $simple_text
  3872. @var{\@@documentdescription_lines} is an array containing the Texinfo lines in @code{@@documentdescription}.
  3873. @var{$text} is the text appearing in @code{@@documentdescription}, formatted.
  3874. @var{$comment} is the text with texi removed, should be very simple
  3875. text.
  3876. @var{$simple_text} is the text formatted in string context
  3877. with minimal formatting but no elements.
  3878. @end deffn
  3879. @xref{HTML Title Page Customization}, for specifics about the title
  3880. page handling.
  3881. @node Other and unknown commands
  3882. @section Customizing other commands, and unknown commands
  3883. @cindex skipped command
  3884. @cindex unknown command
  3885. Many commands without braces are available in Texinfo, sometimes with
  3886. a specific syntax. For example we have @code{@@sp}, @code{@@noindent},
  3887. @code{@@documentlanguage}, @code{@@oddheading}, @code{@@headings},
  3888. @code{@@shortcontents}, @code{@@shorttitlepage} or @code{@@comment}.
  3889. @command{texi2any} interprets
  3890. some of these commands and some functions or variables are used for
  3891. their formatting or to access their information.
  3892. In the default case, however, most of these constructs are ignored.
  3893. It is possible to change how the things following these commands
  3894. on the line are handled, what is considered to be an arg for those
  3895. commands and it is also possible to keep them instead of discarding
  3896. them such that it is possible to handle them specially, with the
  3897. same function than the one used for unknown commands.
  3898. @vindex %misc_command
  3899. Those special commands without braces are the key of a hash:
  3900. @code{%misc_command}. The associated value is a reference on a
  3901. hash enabling to set the properties of these commands. The
  3902. keys of this hash reference is the name of a property, the value
  3903. is the value of the property. For example here we have @code{line}
  3904. for the @code{arg} property for the @code{command} @@-command.
  3905. @example
  3906. $misc_command@{'command'@} = @{'arg' => 'line', 'skip' => 'space'@};
  3907. @end example
  3908. The properties and possible values are:
  3909. @table @code
  3910. @item skip
  3911. This property enables to set what is skipped after the command arguments.
  3912. Here are the possible values:
  3913. @table @code
  3914. @item line
  3915. The remaining of the line is skipped.
  3916. @item space
  3917. Spaces are skipped but not newline.
  3918. @item whitespace
  3919. Spaces are skipped
  3920. @item linewhitespace
  3921. Spaces are skipped if there are only spaces remaining on the line.
  3922. @item linespace
  3923. Spaces are skipped, but not newline if
  3924. there are only spaces remaining on the line
  3925. @end table
  3926. @item arg
  3927. If the associated value is @code{line} the line is considered to be the
  3928. argument. If it is a number it is the number of args (separated by spaces).
  3929. @item keep
  3930. If true the args and the macro are kept, otherwise they are discarded.
  3931. The defaut is to have @code{keep} undef for all the commands.
  3932. If @code{keep} is true for @code{@@verbatiminclude} the default
  3933. action for this macro is not done.
  3934. @end table
  3935. These commands are processed by the @code{misc_command_line} function
  3936. reference. This is somehow redundant with @ref{HTML Customization for
  3937. Title Commands} xx.
  3938. @deftypefn {Function Reference} {($command, $line, $result)} misc_command_line $command $line \@@args \@@stack \%state
  3939. @var{$command} is the @@-command name. @var{$line} is what the main program
  3940. would leave on the line. @var{\@@args} holds the @@-command arguments.
  3941. @var{\@@stack} is an opaque variable.
  3942. @var{\%state} holds informations about the current context.
  3943. The result is the @@-command that should be considered in the
  3944. main program, the line that should be processed further and
  3945. the result of the command formatting.
  3946. @end deftypefn
  3947. Commands which do not appear in the hashes
  3948. @code{%simple_map}, @code{%simple_map_pre},
  3949. @code{%simple_map_texi}, @code{%line_command_map} or @code{%misc_command},
  3950. or that appear in
  3951. @code{%misc_command} but with @code{keep} true are processed by the
  3952. following function reference:
  3953. @deftypefn {Function Reference} {($result_line, $result, $result_text, $message)} unknown $command $line $pass
  3954. @var{$command} is the @@-command, @var{$line} is the line following
  3955. the @var{$command}. @var{$pass} is the pass of texi2html
  3956. (@pxref{texi2any's Three Passes}). @var{$result} is a boolean. If it
  3957. is true then the other return values are taken into account otherwise
  3958. the default actions are used. In case @var{$result} is true,
  3959. @var{$result_line} is the new line to be processed further,
  3960. @var{$result_text} is the resulting formatted text and @var{$message},
  3961. if defined is a message outputted to the output with line number added
  3962. by @command{texi2any}.
  3963. @end deftypefn
  3964. Commands with braces not specified above
  3965. nor in @code{%style_map}, @code{%style_map_pre} and
  3966. @code{%style_map_texi} are processed
  3967. by the following function reference
  3968. @deftypefn {Function Reference} {($result, $result_text, $message)} unknown_style $command $text \%state $no_close $no_open
  3969. @var{$command} is the @@-command, @var{$text} is the text appearing within
  3970. the braces (allready formatted).
  3971. @var{\%state} holds informations about the current context.
  3972. If @var{$text} is split in paragraphs each paragraph is passed through
  3973. the function, and @var{$no_close} is true if it is not the last paragraph,
  3974. while @var{$no_open} is true if it is not the first paragraph.
  3975. @var{$result} is a boolean. If it is true then the other return
  3976. values are taken into account otherwise the default actions are
  3977. used. In case @var{$result} is true, @var{$result_text} is the resulting
  3978. formatted text
  3979. and @var{$message}, if defined is a message outputted to the output
  3980. with line number added by @command{texi2any}.
  3981. @end deftypefn