This content was uploaded by our users and we assume good faith they have the permission to share this book. If you own the copyright to this book and it is wrongfully on our website, we offer a simple DMCA procedure to remove your content from our site. Start by pressing the button below!
hprovidesLu guagefl ihfi ïhprovidesFilef.dtxl (2003/03/18 v1.5 support from the babel system)
.
9 .5
T ailo rin g babel
583
hprovidesl-anguagetnlrnel Lrelease-inform ation? The com m and hprovidesLanguage (l1'ne 34) identifies the language definition file.lt u ses the sam e syntax as BTEX'S hprovidespackage. For instarlce,the file uelsh .1df con tain s the follow ing declaration' . hprovidesLanp zagetwelsh)
R'he release-inform adon can be used to indicate thatatleasttltis version of babel is required. The next section then sets up a docum entation driver to allow for typesetting the .4 docum entation file itself u sm g the doc package.See Ch ap ter 14 for details. dnver 38 39 40
Zhiffalse 11 Babel package for LaTel verslon 2e ZZ Copyright (C) 1989 -- 2003
41 42 43 44
hl by Johnnnes Braams, Texniek Z hl Please report errors to: J.L . Braams hl babel:braams.clstron.nl
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
Z î This file ls part of the babel system , lt provldes the source code for ï the qLanguage> language definition file. Zq*filedriver> hdocumentclassfltxdocl ynevcommand*thTexhaxlfhTel haxl ynevco= u d*tybabellfhtextsffbabelll Nnevcommand*tylaagvarlfshlangle hmathlt laag hraaglesl Nnevcommand*tNnotelEllfl V evco= u d*fhLoptlEllfhtextsff#lll ynevco= u d*thfilelEllfhtextttf#lll hbeginfdocumentl hDoclnputtqlaaguage> .dtxl hendfdocumentl Z Zhfi
61
ZZ hGetFilelnfof.dtxl
62
Z
*
The follow ing part starts w ith the docum entation of the features provided by the Docum enbatlon and language definition flle.U se the m ethods described in Chapterl4 for docum enting inltlalization code and providing a short u ser m anual. 63 64 65 66
Z % ï Z
ych- estv1.1Jf1994/O2/27JfRe= ru ged hch< esfv1.2Jf1994/O6/O4JfUpdate for hchu gesfv1.3Jf1995/O5/13JfUpdate for hch= gesfv1.4Jf1996/1O/3OJfUpdate for
the file a littlel hLaTelel hbabelh release 3.5) hbabelh release 3 .6)
67 68 69 70 71
Z hch= gesfv1.5Jf199T/O3/18JfUpdate for hbabelh release 3.TJ % Z ysectiontThe qLaaguage> laaguagel Z : The flle hfllefhfllenu elhfootnotefThe flle described in thls
72 73 74 75 76
Z section has version number hflleversionh and vas last revised on ï yfiledate.l defines all the laaguage definition macros for the Z laaguage . Z Z hstopEventuallyfl
584
IATEX in a M u ltilingual Environm ent
77 78 79 80 81 82 83 84 85
Z Z The macro IhLdflnit l takes care of preventing that this file is % loaded more than once checking the category code of the l htextttt:l sign, etc. ï ybegintmacrocodel Qq*code> yLdflnitfqlu r age>lfcaptionsqlu guM e>l : hendtmacrocodel Z
hLdf Init
The m acro hLdfInit (line 83) perform s a couple of standard checks that have to b e m ade at the beginnlng of a language dehnition hle, su ch as checking the category code of the @ sign and preventing the .1df hle from being processed tw ice. Il
86
eplp ny ltJfJéuLkgt; 87 and J8Lk/tJ('f5 ga 89 90 91 92 93 94 95 96
97 98 99 l00 101 l02 103 l04 l05 l06
ï
Q
When this file is read as aa option, i.e. by the Ihusepackage l commaad, ytextttfl could be an l to see whether we have to do something here .
: Z Z Z Z hbeginfmacrocodel hifxhundefinedhl: h:nopatternsfl hadddialecthl:ohfi Q hendfmacrocodel
1
'
.
For the qDialect> version of these definitions we just add a
Z ffdialectl'. àlso, the macros Ihcaptionsqdialect>l and Z Ihextrasqdialect>l are Ihletl to their ytexttttqlanguage>l Z counterparts when these parts are defined. Z hbeginfmacrocodel hadddialecthl:hl: ï hendfmacrocodel Q The next step consists of defining commands to switch to land Z from) the language. Z
hadddialectthl:vlrflnllthl:/lngl
The com m and hadddialect adds the nam e of a variant (dialect) language hl:vtzrftznl,for w hich already dehned hyphenation patterns can be used (the ones for language Iangl.ï lf a language has m ore than one variant,you can repeat this section as often as necessary. IdD ialect''is som ew hat of a historical m isnom er,as Iang and variant are at the sam e level as far as babel is concerned, w ithou t co-notation in dicating w hether
one or the other is the m ain language.The iidialect'' paradigm com es in handy if you w ant to share hyphenation patterns betw een various languages.M oreover, if no hyphenation patterns are preloaded in the form at for the language Iang, babel's default behavior is to dehne tltis language as a iidialect'' of the default
language (hlanguageo). lW hen loadin g hyphen ation patterns w ith IN ITEX babelu ses th e haddlanguage com m an d to declare the variou s languages specified in language .dat;see Section 9.5.1.
9.5
Tailoring babel
585
For in stance, the first line below indicates that for A u strian one can u se the
hyphenation patterns for Germ an (deh'ned irlgerman .ldf).The second line tells us thatN ynorsk shares the hyphenation patterns ofN orsk (in norsk .ldJ). hadddialecttyl:austriu lthl:gen u l hadddialectthl:nynorsklthl:norskl T he follow ing exam ple show s how language varian ts can be ob tained u sing the dialect m echanism ,w here there can be diF erences in the nam es of sectioning elem en ts or for the date.
I9-5-1
D ialectical variants: N orsk:B ibliografi N ynorsk' .L itteratur D utch: 29 februari 2004
husepackage Edutch ,afrikaans ,norsk ,nynorsk ,englishq(babel) Di alectical variants : hpar yselectlanguagetnorskl W orsk : hbibname hpar yselectlanguagetnynorskl Nynorsk : hbibname hpar yselectlanguagetdutchl Dutch : htoday hpar
A fnk ' nnns:29 Februarie 2004
yselectlanguagetalrikaansl âfrikaans : htoday
The next part deals w ith the set-up for language attribu tes,if necessary. 107 !08 109 ll0 1ll 1l2 ll3 114 l15 116 1l7 ll8 ll9
% Nov ve declare the lqattrib>l laaguage attribute. % hbeginfmacrocodel hbbl:declr e:ttributeflflfz î hendfmacrocodel % This code adds the expaasion of Ihextrasqattrib>qlaaguage>l to % lhextrasqlaaguage>l. % hbeginfmacrocodel heo u dH terhaddtoyexpu dH terhextrasql age> heo u dH terfhextrasl; hlethcaptionsqlu r M e>hcaptions J % hendfmacrocodel %
hbbl:declare:ttributet//nglt/llrltpxpcl Tltis com m and (used on line 109) declares that for the attribute attr in the language lang, th e cod e exec should b e execu ted. For in stance, th e file greek .ldf deh'nes an attribute polutoniko for th e G reek language:
hbbl:declv e:ttributetgreekltpolutonikolt ...J
W hen you load the Greek language w ith the polutonikogreek option (w ltich is equivalent to setting the attribute polutoniko), Greek w ill then be typeset w ith m ultiple accents (according to the code specified irlthe third argum ent). If you w ant to deh'n e m ore than on e attribu te for th e curren tlanguage,rep eat tltis section as often as necessaly
Detinino Ianouaoe attributes
586
LATEX ill a M ultilingual Env ironm en t
topusflplj? N ow w e deal w ith the m irtim um num b er of characters required to the left and Iljp/ktzàlf-kllt/à? righ t of hyphenation poin ts. /?t.. ' lfl(. 71,à' ?$ 120
121 122 12! 124 125 12b 127
Z
hbeginfmacrolfhhypheM insl
: This macro is used to store the correct values of the hyphenation % parameters Ihlefthyphenminl and Ihrighthyphenminl. Z ybegintmacrocodel yprovidehypheu instqlu guagellfhtw:hthr::l Z yendtmacrocodel Z Nendtmacrol Z
hprovidehypheu inst/lnglthyphpnm jnil
hlD ngulgplhypherlmins
The com m and hprovidehypherlmins (line 124)provides a defaultsetting for the hyphenation param eters hlefthypheu in (m irlim um num ber ofcharacters on the leftbefore the first hyphen point)and hrighthypherlmin (m inim um num bers on the right) for the language Iang,by defining h(D ngulgplhypherlmtns unless itis already defined for som e reason .Th e babelpackage detects w hether the hyph en-
ation file explicitly sets hlefthypherlmin and hrighthypherlmin and autom ati-
cally dehnes htD ngulgplhypherlmins, in w ltich case the hprovidehypherlmins declaration has no effect. The syntax inside babel is storage optim ized, dating back to the days w h en every token counted.Thu s,the argum ent hyphenm ins contains th e valu es for both param eters sim ply as tw o digits,m aking th e assum p tion that you w illnever w ant a m inim um larger than 9. lf tltis assum ption is w rong, you m u st surround the valu es w ith braces w itltin hyphenm ins.For exam ple,
yprovidehypher instgen u lttloltsl) w ould request to leave at least 10 characters before a hyphen and at least 5 char-
acters after it(thus essentially never hyphenate). lf you w an t to explicitly overw rite th e settings regardless of any existing sp ec-
ification,you can do so by providing a value for h(D ngulgplhypherlmins yourself. For in stan ce,
hdefhgernnnhyphenminst43) never considers hyphenation points w ith less than four letters before and three letters after th e hyphen.Thus,it w illnever hyphenate a w ord w ith less than seven ch aracters. H yphenation patterns are built w ith a certain setting of these param eters in
znind. Setting their valu es low er than the valu es u sed in the pattern generation w ill m erely result in incorrect hyphenation.lt is possible,how ever, to use higher values in w ltich case the potential hyph enation points are sim ply reduced. Ir:!n. $2LkIlt?à!$t()r Th e translations for language-depen den t strings are set up next. Itlnq3TlaL)L7-dL7l3(7n(lb'tl( 128 $frlà1j?$ 129 130 13!
g ybegénémacrolfycaptions
9 .5
-
132 133 l34 l35 l36 l37 l38 l39 l40 141
T ailoring babel
587
hdefhcaptionsfl ï hendfmacrocodel % hendfmacrol Z Z hbeginfmacrolfhcaptionsl Z hbeginfmacrocodel hlethcaptionsqdialect>hcaptions Z hendfmacrocodel Z hendfmacrol :
jctyzionsllanguageiqreplacem enttextdelinitionsï The m acro hcaptionsl/tzngutzgp) tline 132) deh'nes the m acros that hold the translation s for th e language-d ep enden t strings u sed irl B TE,X for th e language
Llanguagei.lt m ust also be provided for each dialectbeing setup.lf the dialect uses the sam e translation,hlet can be used (as show n in line 138).O therw ise,you have to provide a full definition .
-
142 l43
ï hbegintmacroltydateqlaaguage>l ï The macro lhdateqlanguage>l redefines the commaad lhtoday l to
144
:
l45 146 l47 148 l49 l50 l5l 152 l53 l54 155 l56 157 l58 l59
Z hbegintmacrocodel hdefhdateqlaaguage>fz J Z hendtmacrocodel Z hendtmacrol Z Z hbegintmacrolfhdateqdialect>l ï The macro Ihdateqdialect>l redefines the commaad lhtoday l to h produce qDialect> dates. % hbegintmacrocodel hdefhdateqdialect>f% J Z hendtmacrocodel Z hendfmacrol Z
produce qLaaguage> dates.
hdatelD ngutzgp)Ldepnition ofJJZ J The m acro hdatel/tzngutzgp) tline 146)deh'nes the text string for the htoday com m and for the language (languageibeing deh'ned irla .ldf file. For som e languages (or dialects), extra definitions have to be provided.Tltis is Providino extra don e irl the n ext section. l60 l6l l62 l63 l64 l65 166 167 l68 l69 170 17l l72
Z hbeginfmacrolfhextrasl Z hbeginfmacrolfhnoextrasl : The macro lhextrasqlaaguage>l vill perform all the extra Z definitions needed for the language. The macro h lhnoextrasqlaaguage>l is used to caacel the actions of h lhextrasl. For the moment these macros are empty but ï they are defined for compatibility vith the other Z laaguage definition files. Z Z hbegintmacrocodel haddtohextrasqlanguage>fl haddtohnoextrasqlaaguage>tl Z hendfmacrocodel
features
588
LATEX ill a M ultilingual Env ironm ent
173 174 l75 176 177 178 179 180 181 182 183 184 185 186
X yendtmacrol % yendtmacrol h X ybegintmacrolthextrasqdialect>l R ybegintmacrolfhnoextrasqdialectll % llso for the ff
Lexzrtsqlanguagejqextra depnidonsl The m acro hextras Llanguage) (line 170)contains allextra definftions needed for the language (Ianguage) being defined in a .ldf file. Such extras can be com -
m ands to turn shorthands on or oft to m ake certain characters active,to initiate French spacing,to position um lauts,and so on.
hnoextras(Ianguage)Lreverse extra depnitionsl T o allow sw itching betw een any tw o languages,itis necessary to return to a know n state for th e TEX engine- in particular, w ith respect to the dehnitions initiated
by the com m and hextras(Ianguage).The m acro hnoextras(Ianguage) (line 171) m u st contain code to revert all such definitions so as to bring TEX back to a know n state .
('Ivbln u/?ùIIIù/tllllsh T he file finishes w ith the follow ing lines of code. 187 188 l89 190 191 !92 193 !94 195 196 197
Z The macro Ihldf:finish l takes care of looking for a Z configuration file, setting the main language to be switched on Z at Ihbeginfdocumentll and resetting the category code of Z htextttf:l to its original value. Z hbegintmacrocodel hldf:finishfl Z
X hendfmacrocodel X Z hFinale Zhendinput