summaryrefslogtreecommitdiff
path: root/language/hyphenation/hypht1.tex
blob: 4b07f5b50134c98651689ceef47e4043ff3d7792 (plain)
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
% This is `hypht1.tex' as of January 31, 2000.
%
% Copyright (C) 1995-2000 Bernd Raichle/DANTE e.V.
%
% -----------------------------------------------------------------
% IMPORTANT NOTICE:
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
% -----------------------------------------------------------------
%
% This file contains additional hyphenation patterns including
% the character hyphen `-' to be used in conjunction with
%
%   * all fonts with font encoding T1 and
%   * all national hyphenation patterns.
%
% It enables the hyphenation of words containing explicit hyphens
% when using fonts with \hyphenchar\font <> `\- (e.g. EC fonts).
%
% It is an experimental version for testing and includes all
% lowercase characters (including national characters) in T1
% encoded fonts.
% In 1990 at the TUG meeting at Cork, Ireland, the european TeX
% user groups agreed on a 256 character encoding supporting many
% european languages with latin writing.  LaTeX2e supports this
% character encoding as font encoding "T1".
%
%
% The additional patterns add about 2600 patterns and 6 trie ops.
% Be warned---to load the patterns in the IniTeX pass when creating
% a new format a very large hyphenation trie is needed!
% Example: TeX reports for "hyphen.tex"
%    Hyphenation trie of length 6075 has 181 ops out of ...
% with the additional patterns it will report
%    Hyphenation trie of length 8618 has 187 ops out of ...
%
%
% Note:
%    The \hyphenation command gives special interpretation to the
%    character `-'.  Therefore it is not possible to include a
%    word with an explicit hyphen as hyphenation exception without
%    the following trick (from David Kastrup):
%
%    \begingroup
%      % Make `=' to be seen as an explicit hyphen inside \hyphenation:
%      \lccode`\==`\-
%      % Example: Declare hyphenation points of `government-founded':
%      \hyphenation{gov-ern-ment=-foun-ded}
%    \endgroup
%
%
% Error reports for "hypht1.tex" in case of UNCHANGED versions to
%
%          Bernd Raichle
%          Stettener Str. 73
%          D-73732 Esslingen, FRG
%   Email: raichle@Informatik.Uni-Stuttgart.DE
%
% or 
%          DANTE e.V., Koordinator `german.sty'
%          Postfach 10 18 40
%          D-69008 Heidelberg, FRG
%   Email: german@Dante.DE
%
%
% Installation:
% =============
%
% 1. Make sure that the hyphenation trie of your TeX version has
%    enough room to load more hyphenation patterns (cf. "pattern
%    memory", "trie size" in the documentation of your
%    implementation).
%
% 2. load "hypht1.tex" in addition to _every_ hyphenation
%    patterns file (i.e. for every value of \language) you are
%    using; make sure that \language has not been changed.
%
%    Example for LaTeX2e (without Babel's ``language.dat''):
%    To load US English and German hyphenation patterns, and load
%    "hypht1.tex" in addition to both sets of patterns, create a
%    file "hyphen.cfg" with the following contents:
%
%       \chardef\l@USenglish=0 \language=\l@USenglish
%       \input hyphen
%       \input hypht1
%
%       \newlanguage\l@german \language=\l@german
%       \input dehypht
%       \input hypht1
%
%       \language=\l@USenglish
%       \lefthyphenmin=2 \righthyphenmin=3
%       \endinput
%
%    Example for LaTeX2e (using Babel's ``language.dat''):
%    To load a second file including additional hyphenation patterns
%    and hyphenation exceptions you specify the name of the file
%    in ``language.dat'' in addition to the regular hyphenation
%    pattern file name.  For example
%       USenglish       hyphen.tex    hypht1.tex
%       german          dehypht.tex   hypht1.tex
%
%
% 3. Use IniTeX to create a new format file.
%
%
% Changes:
%  1997-04-13 v0.2 First release found on CTAN.
%  2000-01-31 v0.3 added missing glyphs '340-'377
%             (thanks to Vladimir Volovich)
%
% -----------------------------------------------------------------
%
\begingroup\expandafter\expandafter\expandafter
\endgroup\expandafter\ifx\csname ProvidesFile\endcsname\relax
  \wlog{File: hypht1.tex 2000/01/31 v0.3 %
        Additional Hyphenation Patterns for T1-encoded fonts}
\else
  \ProvidesFile{hypht1.tex}%
     [2000/01/31 v0.3 Additional Hyphenation Patterns %
                      for T1-encoded fonts]
\fi
%
%
% It is possible to use T1-encoded font with TeX 2.x and
% include a subset '000-'177 of these additional hyphenation
% patterns.  Nonetheless TeX 2.x is unable to process more than
% one \patterns.  If you want to use these patterns, you have to
% include some changes below and in the used set of patterns.
% (You can contact the author for more information.)
%
\ifnum`\A=`\^^41 % TeX 2 or TeX 3?
\else
  \message{Sorry, you need TeX 3.x to use these patterns.}
  \expandafter\endinput
\fi
%
%
% Make hyphen `-' a word constituent:
%
\lccode`\-=`\-
%
%
% \patterns has a global effect, therefore we can open a group,
% make local changes, call \patterns{...}, close the group, and
% all changes are gone.
%
\begingroup
%
% Some feedback for users with slow computers:
%
\message{...please be patient...}
%
%
\toksdef\L=0 \L={}%  list of two letter patterns
\toksdef\S=2 \S={}%  list of "simple" patterns
%
\countdef\C=2  % use \C as temporary register for _c_har code
\countdef\i=0  % temporary register: loop index i
%
\catcode`\Y=11 \lccode`\Y=0   % we need `Y' for special purposes
\catcode`\X=11 \lccode`\X=0   % dto for `X'
%
%
% 1) trivial cases:
%
\S={%
  8-7    % disallow hyphenation before, allow after hyphen
  .-8    % disallow hyphenation for cases like "bergauf und -ab"
  --8    % disallow hyphenation "in" an en- or em-dash (-8-),
         % disallow hyphenation before and after an en- or em-dash
         % (--8 + 8-7 ==> 8-8-8) because EC fonts v1.0 are missing
         % appropriate ligatures for --(-) + hyphenchar!
}
% \changes{v0.2}{1997/02/01}{Replaced `2-1', `.-2' by `8-7', `.-8',
%    otherwise it is possible that the `2' is overwritten by a
%    greater odd value of another pattern.}
% \changes{v0.2}{1997/04/13}{Added `8-8-8' resp. `--8' for
%    EC fonts v1.0.}
%
%
% 2a) for all lowercase letters:
%     change catcode to letter (or other) to make sure that these
%            characters are not active, ignored, etc. and
%     change lccode to a non-zero value to allow its use inside
%            \patterns
%
% 2b) Add the patterns
%         .X-8    % disallow "X-|ray", "n-|fach", etc.
%         8X8Y-   % => "\righthyphenmin"=3 and "\lefthyphenmin"=3
%         -X8Y    %    before and after the hyphen
%     for all X,Y in the set of lowercase letters.
%
%
\def\a#1{%     add pattern to pattern list \L
  \C=#1\relax \catcode\C=11\lccode\C=\C
  \lccode`X=\C
  \lowercase{%
    \S\expandafter{\the\S .X-8 }%
    \L\expandafter{\the\L 8X8Y- -X8Y8 }%
  }}
%
% \changes{v0.2}{1997/02/01}{Replaced `X-2' by `X-8,
%    otherwise it is possible that the `2' is overwritten by a
%    greater odd value of another pattern.}
%  
\def\y{%
  %
  % Add patterns for "lowercase letter d with bar"
  %
  \a{'236}%  lowercase letter d with bar
  %
  % ... and for all lowercase characters:
  %
  % for i=`z downto `a do
  %  change catcode & lccode of char with code i
  %  add patterns for this char
  % endfor
  %
  \i=`\z \advance\i 1 %
  %
  \def\x{%
    \ifnum\i>`\a %
      \advance\i -1 %
      \a\i            % add patterns for char `i'
      \expandafter\x
    \fi}%
  \x
  %
  % for i = char "ij" ('274) downto char "a breve" ('240) do
  %  change catcode & lccode of char with code i
  %  add patterns for this char
  % endfor
  %
  \i='275  % = '274 + 1   '274: lowercase letter ij
  %
  \def\x{%
    \ifnum\i>'240 %
      \advance\i -1 %
      \a\i            % add patterns for char `i'
      \expandafter\x
    \fi}%
  \x
  %
  % \changes{v0.3}{2000/01/31}{Added code for char '340-'377.}
  %
  % for i = char "sharp s" ('377) downto char "a grave" ('340) do
  %  change catcode & lccode of char with code i
  %  add patterns for this char
  % endfor
  %
  \i='377 \advance\i 1 %
  %
  \def\x{%
    \ifnum\i>'340 %
      \advance\i -1 %
      \a\i            % add patterns for char `i'
      \expandafter\x
    \fi}%
  \x
  %
}% -- end of \y --
%
% Now do the real work:
%
\y
%
%
% The list of "simple" patterns is ready to use:
%
\patterns{ \the\S }%
\S={}% free memory used for token list
%
%
% Now \L contains all needed patterns for all characters X
% and one character Y.  To finish our task we have to loop over Y
% for all lowercase characters.
%
\def\h#1\relax{% lowercase #1 and add patterns
  \lowercase{%
    \patterns{#1}%
  }}
%
\def\a#1{%     add patterns in \L with Y replaced by #1
  \lccode`Y=#1\relax
  \expandafter\h\the\L\relax
}
%
% Now do the real work (with the redefined macro \a):
%
\y
%
\message{done.}
%
% Restore all \catcode and \lccode setting, definitions for
% csname, register changes, etc.
%
\endgroup
\endinput
%% 
%% End of file `hypht1.tex'.