summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-hyphexcept.html
blob: 7bf5d129683f7062257347ecd3113908862fb103 (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&#8217;s hyphenation rules are good, they&#8217;re not infallible: you
will occasionally find words TeX just gets <em>wrong</em>.  So for
example, TeX&#8217;s default hyphenation rules (for American English) don&#8217;t
know the word &#8220;<em>manuscript</em>&#8221;, and since it&#8217;s a long word you
may find you need to hyphenate it.  You <em>can</em> &#8220;write the
hyphenation out&#8221; each time you use the word:
<blockquote>
<pre>
... man\-u\-script ...
</pre>
</blockquote><p>
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&#8217;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><p>
and the hyphenation would be set for the whole document.  Barbara
Beeton publishes articles containing lists of these &#8220;hyphenation
exceptions&#8221;, in <i>TUGboat</i>; the hyphenation &#8216;man-u-script&#8217;
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><p>
(nothing clever here: this is the &#8220;correct&#8221; hyphenation of the word,
in the current tables).  However, there&#8217;s a problem here: just as
words with accents in them won&#8217;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><p>
tells us that the hyphenation is &#8220;improper&#8221;, and that it will be &#8220;flushed&#8221;.
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>
<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>