[XeTeX] How to make hyphenation work in XeLaTeX?

Jonathan Kew jonathan_kew at sil.org
Mon Jan 22 11:43:03 CET 2007


On 22 Jan 2007, at 9:24 am, Yves Codet wrote:
>
> The problem you have, and many other users have, was clearly
> explained by Bruno Voisin in a previous post (unfortunately I don't
> have it at hand): we need a replacement for Babel. Perhaps a minimal
> post-Babel package could only include a way to select hyphenation
> patterns, which seems to be the most urgent need.

Note that TL2007 includes Greek hyphenation patterns by default (both  
ancient and modern), so with a new distribution you shouldn't need to  
do anything with language.dat in order to load them. When I run  
xelatex, it reports

   LaTeX2e <2005/12/01>
   Babel <v3.8h> and hyphenation patterns for english, usenglishmax,  
dumylang, noh
   yphenation, basque, bulgarian, coptic, welsh, czech, slovak,  
german, ngerman, d
   anish, spanish, catalan, galician, esperanto, estonian, finnish,  
french, greek,
   monogreek, ancientgreek, croatian, hungarian, interlingua, ibycus,  
indonesian,
   icelandic, italian, latin, mongolian, dutch, norsk, polish,  
portuguese, pinyin
   , romanian, russian, slovene, uppersorbian, serbian, swedish,  
turkish, ukenglis
   h, ukrainian, loaded.


If your document declares something like

   \usepackage[greek,russian,english]{babel}

then the patterns are available; the main problem is that if you say

   \selectlanguage{greek}

to set the hyphenation language, this will *also* mess with your font.

To work around this, you could say

   \let\greektext\relax

after loading the Babel package; this eliminates Babel's hook that  
changes the font/encoding. So if you've selected Gentium with  
fontspec, everything should be fine. (As far as hyphenation and font  
choice are concerned. The Greek text for headings, captions, etc.,  
won't be right, as the Babel file greek.ldf is non-Unicode.)

For Russian (or presumably other Cyrillic-script languages), I think  
you want to say

   \def\cyrillicencoding{EU1}

*before* loading Babel, IIRC.

All this is a bit messy, but until there's a Unicode-aware Babel  
replacement or update, it should be possible to work around the  
issues using techniques like this.

HTH,

JK



More information about the XeTeX mailing list