summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-hyphexcept.html
blob: 6361da94463b5b2eb795e79050456962cd0f2e09 (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
<head>
<title>UK TeX FAQ -- question label hyphexcept</title>
</head><body>
<h3>Hyphenation exceptions</h3>
<p>While TeX's hyphenation rules are good, they're not infallible: you
will occasionally find words TeX just gets <em>wrong</em>.  So for
example, TeX's default hyphenation (for American English) don't
know the word "<em>manuscript</em>", and since it's a long word you
may find you need to hyphenate it.  You <em>can</em> "write the
hyphenation out" each time you use the word:
<blockquote>
<pre>
... man\-u\-script ...
</pre>
</blockquote>
Here, each of the <code>\</code><code>-</code> commands is converted to a hyphenated break,
if (<em>and only if</em>) necessary.
<p>That technique can rapidly become tedious: you'll probably only accept
it if there are no more than one or two wrongly-hyphenated words in
your document.  The alternative is to set up hyphenations in the
document preamble.  To do that, for the hyphenation above, you would
write:
<blockquote>
<pre>
\hyphenation{man-u-script}
</pre>
</blockquote>
and the hyphenation would be set for the whole document.  Barbara
Beeton publishes articles containing lists of these "hyphenation
exceptions", in <i>TUGboat</i>; the hyphenation 'man-u-script'
comes from one of those articles.
<p>What if you have more than one language in your document?  Simple:
select the appropriate language, and do the same as above:
<blockquote>
<pre>
\usepackage[french]{babel}
\selectlanguage{french}
\hyphenation{re-cher-cher}
</pre>
</blockquote>
(nothing clever here: this is the "correct" hyphenation of the word,
in the current tables).  However, there's a problem here: just as
words with accents in them won't break, so <code>\</code><code>hyphenation</code> commands
with accents in them produce an error:
<blockquote>
<pre>
\usepackage[french]{babel}
\selectlanguage{french}
\hyphenation{r\'e-f\'e-rence}
</pre>
</blockquote>
tells us that the hyphenation is "improper", and that it will be "flushed".
But, just as hyphenation of words is enabled by selecting an 8-bit
font encoding, so <code>\</code><code>hyphenation</code> commands are rendered proper again
by selecting that same 8-bit font encoding.  For the hyphenation
patterns provided in the usual distributions, the encoding is
<a href="FAQ-ECfonts.html">Cork</a>, so the complete sequence is:
<blockquote>
<pre>
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\selectlanguage{french}
\hyphenation{r\'e-f\'e-rence}
</pre>
</blockquote>
<p>The same sort of performance goes for any language for which 8-bit
fonts and corresponding hyphenation patterns are available.  Since you
have to select both the language and the font encoding to have your
document typeset correctly, it should not be a great imposition to do
the selections before setting up hyphenation exceptions.
<p><p><p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=hyphexcept">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=hyphexcept</a>
</body>