1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
|
\usetypescript[antykwa-poltawskiego]
\setupbodyfont[antykwa-poltawskiego,10pt]
\setuphead
[section]
[style=\bfc,numberstyle=\bfc]
\setuphead
[subsection]
[style=\bfb,numberstyle=\bfb]
\setuphead
[subsubsection]
[style=\bfa,numberstyle=\bfa]
\setuphead
[title]
[style=\bfd]
\setuppagenumbering
[location={footer,right},style=\os]
\setuplayout
[backspace=1in,width=middle,
header=0pt,headerdistance=0pt,height=24.5cm]
\def\sc{\addff{smallcaps}}
\def\os{\addff{oldstyle}}
\def\eTeX{ε-\TeX}
% TODO
\def\XeLaTeX{Xe\LaTeX}
\def\LuaLaTeX{Lua\LaTeX}
\def\pTeX{p\TeX}
\definecolor
[verylightgray]
[s=.95]
\defineframedtext
[framedCODE]
[frame=off,
strut=yes,
offset=2mm,
width=.9\textwidth,
location=middle,
background=color,
backgroundcolor=verylightgray]
\definetyping
[TEX]
[option=TEX,
before={\startframedCODE},
after={\stopframedCODE}]
\starttext
\title{The {\tt hyph-utf8} package and hyphenation with \TeX}
\blank[big]
\startnarrower
{\bf Maintainers} of the {\tt hyph-utf8} package and collectors of patterns:
\startnarrower
\startitemize[packed,joinedup]
\item {\it Mojca Miklavec, Arthur Reutenauer}
\item With contributions by {\it Khaled Hosny, Manuel Pégourié-Gonnard, Élie Roux}
\stopitemize
\stopnarrower
\stopnarrower
\blank
\startnarrower
{\bf Main description}:
\startnarrower
June 2011
\stopnarrower
\stopnarrower
\startnarrower
{\bf Latest editorial change}:
\startnarrower
16 Mars 2018
\stopnarrower
\stopnarrower
\blank
\startnarrower
{\bf Abstract}:
\startnarrower\sl
In 2008 all the existing hyphenation patterns from \TeX\ distributions have
been collected in a single package {\tt hyph-utf8}, converted into UTF-8
encoding and adapted for use in different \TeX\ engines. The patterns can be
used directly by Unicode-aware engines such as \LuaTeX\ and \XeTeX, and there
is a mechanism to convert the patterns to the appropriate 8-bit encoding when
used with \pTeX, \pdfTeX\ or Knuth's \TeX.
\stopnarrower
\stopnarrower
\blank
\startnarrower
{\bf Table of Contents}:
\blank
\startnarrower
\setuplist[section] [width=10mm,textstyle=\bf\sc,numberstyle=\bf\os,pagestyle=\os]
\setuplist[subsection] [width=15mm,textstyle=normal,numberstyle=\os,pagestyle=\os]
\setuplist[subsubsection][distance=20mm,headnumber=no,textstyle=italic,pagestyle=\os]
\placecontent[criterium=all,alternative=c]
\stopnarrower
\stopnarrower
\page
\section{Using hyphenation patterns}
\subsection{Plain \TeX}
In engines that support \eTeX\ you can select the desired hyphenation patterns with:
\startTEX
\uselanguage{langname}
\stopTEX
where \type{langname} is the string identifying a particular hyphenation file in \type{language.def} (see Section \in[sec:languages]).
\subsection{\LaTeX}
\subsubsection{\LaTeX\ with Babel}
You can switch the language in \LaTeX\ with:
\startTEX
\usepackage[languagename]{babel}
\stopTEX
In 8-bit engines you also need to make sure that you load the proper font encoding which supports all the characters used in the language of your choice, for example:
\startTEX
\usepackage[T1]{fontenc}
\stopTEX
% TODO: reference to encoding list
{\it N.B.:}\/ You can use Babel with any \TeX\ engine, however it has never been properly adapted to work well with Unicode engines. If you are using \XeTeX\ it is advisable to use Polyglossia instead.
\subsubsection{\LaTeX\ with Polyglossia}
Polyglossia should be the preferred choice when using \XeLaTeX. It doesn't support \LuaLaTeX\ yet, but it is planned to extend it in future.
\startTEX
\usepackage{polyglossia}
\setmainlanguage[optional settings]{langname}
\setotherlanguages{otherlangname}
\begin[optional settings]{otherlangname} ... \end{otherlangname}
\stopTEX
See Polyglossia manual for extensive list of options.
\subsubsection{Low-level commands}
Since Babel's \type{hyphen.cfg} is built into the \LaTeX\ format, hyphenation patterns can be used without even loading Babel or Polyglossia. At the low-level this simply corresponds to defining
\startTEX
\language=\l@<langname>
\stopTEX
The user command is supposed to be
\startTEX
\hyphenrules{langname}
\stopTEX
or
\startTEX
\begin{hyphenrules}{langname} ... \end{hyphenrules}.
\stopTEX
and {\it should}\/ work with any flavour of \LaTeX, however we couldn't make it work.
\subsection{\ConTeXt}
\ConTeXt\ doesn't load patterns for all the language that {\tt hyph-utf8} provides. If you miss any language, please contact the mailing list. The general syntax for supported languages is the following:
\startTEX
% language of the main document
\mainlanguage[language]
% to switch to another language locally
{\language[otherlanguage] language of some short fragment}
\stopTEX
You can use full language name or the two-letter language code.
\subsubsection{\ConTeXt\ MkII}
When using \ConTeXt\ MkII the EC/T1 font encoding is used by default already, but you might need to change the encoding when using Polish, languages written in Cyrillic scripts, etc. For example:
\startTEX
\usetypescript[iwona][qx]
\setupbodyfont[iwona]
\mainlanguage[polish]
\stopTEX
\ConTeXt\ loads hyphenation patterns in several encodings. The Czech or Slovak patterns can be used with both EC and IL2 font encoding for example. The right hyphenation patterns will be chosen based on current font encoding.
\subsection{Some advanced examples}
\subsubsection{Example for Polyglossia}
\startTEX
\usepackage{polyglossia}
% the language used for main document
\setmainlanguage{asturian}
% American English with extended hyphenation patterns
\setotherlanguage[variant=usmax]{english}
% German with experimental patterns "ngerman-x-latest"
\setotherlanguage[spelling=new,latesthyphen=true]{german}
\setotherlanguages{spanish,catalan,french}
\begin{document}
Long Asturian text ... (Hyphenation for Asturian is not available,
but polyglossia automatically falls back on Catalan for now,
which seems to be a reasonable choice.)
\begin{german}
Deutscher Text ... (with the hyphenation patterns selected above:
"ngerman-x-latest")
\end{german}
\begin[script=fraktur,spelling=old]{german}
Deutſcher Text ... (set in Fraktur, with traditional hyphenation).
\end{german}
\end{document}
\stopTEX
\page
\section[sec:languages]{List of supported languages}
For several languages, there is additional documentation in a separate file: see
\startitemize[packed]
\item For German, \type{dehyph-exptl.pdf}
\item For Spanish, \type{division.pdf}
\stopitemize
\def\lanname#1{\hbox to \textwidth{\bf#1\hss}}
\def\landata#1#2#3{\hbox to \textwidth{\hbox to 3mm{}\hbox to 6.5em{#1\hss}\hbox to 7em{#2}\hbox{#3}\hss} }
\lanname{English}
\landata{-}{\bf english}{usenglish, USenglish, american}
\landata{en-us}{usenglishmax}{}
\landata{en-gb}{ukenglish}{british, UKenglish}
\startcolumns[n=2]
\lanname{Afrikaans}
\landata{af}{afrikaans}{}
\lanname{Ancientgreek}
\landata{grc}{ancientgreek}{}
\landata{grc-x-ibycus}{ibycus}{}
\lanname{Arabic}
\landata{ar}{arabic}{}
\lanname{Armenian}
\landata{hy}{armenian}{}
\lanname{Assamese}
\landata{as}{assamese}{}
\lanname{Basque}
\landata{eu}{basque}{}
\lanname{Belarusian}
\landata{be}{belarusian}{}
\lanname{Bengali}
\landata{bn}{bengali}{}
\lanname{Bulgarian}
\landata{bg}{bulgarian}{}
\lanname{Catalan}
\landata{ca}{catalan}{}
\lanname{Chinese}
\landata{zh-latn-pinyin}{pinyin}{}
\lanname{Church Slavonic}
\landata{cu}{churchslavonic}{}
\lanname{Coptic}
\landata{cop}{coptic}{}
\lanname{Croatian}
\landata{hr}{croatian}{}
\lanname{Czech}
\landata{cs}{czech}{}
\lanname{Danish}
\landata{da}{danish}{}
\lanname{Dutch}
\landata{nl}{dutch}{}
\lanname{Esperanto}
\landata{eo}{esperanto}{}
\lanname{Estonian}
\landata{et}{estonian}{}
\lanname{Ethiopic}
\landata{mul-ethi}{ethiopic}{amharic, geez}
\lanname{Farsi}
\landata{fa}{farsi}{persian}
\lanname{Finnish}
\landata{fi}{finnish}{}
\column
\lanname{French}
\landata{fr}{french}{patois, francais}
\lanname{Friulan}
\landata{fur}{friulan}{}
\lanname{Galician}
\landata{gl}{galician}{}
\lanname{Georgian}
\landata{ka}{georgian}{}
\lanname{German}
\landata{de-1901}{german}{}
\landata{de-1996}{ngerman}{}
\landata{de-ch-1901}{swissgerman}{}
\lanname{Greek}
\landata{el-monoton}{monogreek}{}
\landata{el-polyton}{greek}{polygreek}
\lanname{Gujarati}
\landata{gu}{gujarati}{}
\lanname{Hindi}
\landata{hi}{hindi}{}
\lanname{Hungarian}
\landata{hu}{hungarian}{}
\lanname{Icelandic}
\landata{is}{icelandic}{}
\lanname{Indonesian}
\landata{id}{indonesian}{}
\lanname{Interlingua}
\landata{ia}{interlingua}{}
\lanname{Irish}
\landata{ga}{irish}{}
\lanname{Italian}
\landata{it}{italian}{}
\lanname{Kannada}
\landata{kn}{kannada}{}
\lanname{Kurmanji}
\landata{kmr}{kurmanji}{}
\lanname{Latin}
\landata{la}{latin}{}
\landata{la-x-classic}{classiclatin}{}
\landata{la-x-liturgic}{liturgicallatin}{}
\lanname{Latvian}
\landata{lv}{latvian}{}
\lanname{Lithuanian}
\landata{lt}{lithuanian}{}
\lanname{Malayalam}
\landata{ml}{malayalam}{}
\column
\lanname{Marathi}
\landata{mr}{marathi}{}
\lanname{Mongolian}
\landata{mn-cyrl}{mongolian}{}
\landata{mn-cyrl-x-lmc}{mongolianlmc}{}
\lanname{Norwegian}
\landata{nb}{bokmal}{norwegian, norsk}
\landata{nn}{nynorsk}{}
\lanname{Occitan}
\landata{oc}{occitan}{}
\lanname{Oriya}
\landata{or}{oriya}{}
\lanname{Panjabi}
\landata{pa}{panjabi}{}
\lanname{Polish}
\landata{pl}{polish}{}
\lanname{Piedmontese}
\landata{pms}{piedmontese}{}
\lanname{Portuguese}
\landata{pt}{portuguese}{portuges}
\lanname{Romanian}
\landata{ro}{romanian}{}
\lanname{Romansh}
\landata{rm}{romansh}{}
\lanname{Russian}
\landata{ru}{russian}{}
\lanname{Sanskrit}
\landata{sa}{sanskrit}{}
\lanname{Serbian}
\landata{sr-latn}{serbian}{}
\landata{sr-cyrl}{serbianc}{}
\lanname{Slovak}
\landata{sk}{slovak}{}
\lanname{Slovenian}
\landata{sl}{slovenian}{slovene}
\lanname{Spanish}
\landata{es}{spanish}{espanol}
\lanname{Swedish}
\landata{sv}{swedish}{}
\lanname{Tamil}
\landata{ta}{tamil}{}
\lanname{Telugu}
\landata{te}{telugu}{}
\lanname{Thai}
\landata{th}{thai}{}
\lanname{Turkish}
\landata{tr}{turkish}{}
\lanname{Turkmen}
\landata{tk}{turkmen}{}
\lanname{Ukrainian}
\landata{uk}{ukrainian}{}
\lanname{Uppersorbian}
\landata{hsb}{uppersorbian}{}
\lanname{Welsh}
\landata{cy}{welsh}{}
\stopcolumns
\blank[2*big]
Babel defines a few more synonyms (which consequently only work in \LaTeX):
\def\lansyn#1#2{\hbox to \textwidth{\hbox to 3mm{}\hbox to 6.5em{\bf#1\hss}\hbox{#2}\hss}}
\lansyn{english}{canadian}
\lansyn{british}{australian, newzealand}
\lansyn{german}{austrian}
\lansyn{ngerman}{naustrian, nswissgerman}
\lansyn{portuguese}{brazilian, brazil}
% TODO: bibliography
\stoptext
|