[XeTeX] How to make hyphenation work in XeLaTeX?

Nikola Lecic nlecic at EUnet.yu
Sun Jan 21 23:47:00 CET 2007

Hello Jonathan and Mojca,

I'd like to take part in this discussion and ask: "What is the real, 
proper Xe(La)TeX (utf8-based) way to enable hyphenation and to access 
utf8 hyphenation files"? I personally want to typeset documents 
containing English, Serbian (Cyrillic) and Ancient Greek, with frequent 
mixing of all three languages, often in the same line. XeLaTeX should 
hyphenate a line according to the rule of language which happens to 
occupy the end of line. I actually don't understand XeTeX's way of 
setting language environments.

1. As for Ancient Greek, I downloaded files from

(a) http://tug.ctan.org/tex-archive/macros/xetex/hyphenation/greek/
(b) http://tug.ctan.org/tex-archive/macros/xetex/hyphenation/grchyph/

and placed them to XeTeX's hypenation directory. As for Cyrillic 
Serbian, there is a plainTeX-style file (srhyphc.tex) without utf8 

2. Now, what is the proper XeLaTeX way to say: {This is 'Ancient Greek' 
here and do everything -- hyphenation, font features, etc. -- having 
that in mind}? First, I did something like this:

\newcommand{\gr}[1]{\fontspec[Script=Greek,Language=Greek]{Gentium} #1}}
SIL} #1}}

and then, for example

\gr{Τιμὴ δ' ἐστὶν ἡμῖν, ὡς τὸ ὅλον εἰπεῖν, τοῖς μὲν ἀμείνοσιν ἕπεσθαι, 
τὰ δὲ χείρονα, γενέσθαι δὲ βελτίω δυνατά, τοῦτ' αὐτὸ ὡς ἄριστα ἀποτελεῖν.}
\sr{Сократ: Зар Епидаурани у част бога приређују и надметање рапсода? -- 
Ијон: Дабоме, као и друга музичка надметања.}

In order to enable Ancient Greek hyphenation I tried rewritting 
language.dat (according to Jonathan's explanation from SIL XeTeX FAQ) and:

(i) example from (b), adding "\language=\greek" _inside_ \gr command, 
but XeLaTeX reported that "\language=\greek" is "Undefined control 

(ii) Will's idea from 
http://www.tug.org/pipermail/xetex/2006-February/003112.html (with 
but that obviously did nothing, just producing a heap of 'Overfull 
\hbox'-es (just like without it);

(iii) Jonathan's reccomendation from the same thread (with 
\AtBeginDocument), with the same result. Invoking babel with any 
language order (and using \SelectLanguage{greek} inside \gr command) 
leads to "kpathsea: Running mktexmf grmn1095.mf, name = grmn1095, 
rootname = grmn, pointsize = 1095, mktexmf: empty or non-existent 
rootfile! Cannot find grmn1095.mf"-like errors.

(iv) (Probably interesting for Mojca) If I try these things using Latin 
Serbian (which shares the most of its character set with Slovenian 
language), I get similar results as he did: hyphenation almost works, 
but obviously based on English rules.

So, what should be done? How to tell XeLaTeX what language I need 
_inside_ \gr and \sr commands -- and why XeLaTeX simply doesn't follow 
language font settings -- which should be the most elegant, in my humbe 
opinion? (And by the way, I'd especially like to do all these things 
without babel, if possible.)

I have an impression that I miss something tiny, but don't know what :)


Mojca Miklavec a écrit :
> Hello,
> I'm sorry for a newbie question (I'm most probably missing something
> really obvious, but I almost never use LaTeX.): How do I get
> (default?) LM + hyphenation to work under XeLaTeX?
> I tried the following:
> \documentclass{article}
> \usepackage[slovene]{babel}
> %\usepackage{fontspec} % do I need this ?
> \usepackage[EU1]{fontenc}
> \begin{document}
> % should be:
> lo-ko-mo-ti[-]va ču-ha-pu[-]ha
> \def\a{lokomotiva čuhapuha}
> \a
> \showhyphens{\a}
> \end{document}
> I get some hyphens, but log file (slightly longer text) seems pretty
> weird (no hyphens shown):
> Overfull \hbox (0.82622pt too wide) in paragraph at lines 13--14

> \EU1/lmr/m/n/10 prodajalna ne moralizirajo. Moja
> [1]
> Underfull \hbox (badness 10000) in paragraph at lines 17--17
> [] \EU1/cmr/m/n/10 lokomotiva čuhapuha
> [2] (./latex-slo.aux)
> I also don't understand why there is "cmr" in the last line. (from
> \showhyphens).
> Thanks a lot,
>     Mojca
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex

More information about the XeTeX mailing list