Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Assume I have a word like Baden-Württemberg. TeX can't hyphenate any of these two word parts. Why?

no hyphenation in the compound word

why isn't it something like this:

enter image description here

where the small ticks indicate possible hyphenation points. A technical (TeXnical) explanation is welcome.

BTW: I am not asking how to circumvent this (by using the babel shorthand "= for example).

share|improve this question
5  
Because so decided Knuth. –  egreg Jul 13 '12 at 19:35
1  
@egreg but why? I mean, what parts of TeX makes decide to disable hyphenation? Is there an explicit "if word contains hyphen char, then exit" somewhere in the hyphenation routine? –  topskip Jul 13 '12 at 19:37

1 Answer 1

up vote 18 down vote accepted

The TeXbook, page 454, last but one double dangerous bend paragraph

If a trial word l1 … ln has been found by this process, hyphenation will still be abandoned unless n ≥ λ + ρ, where λ = max(1,|\lefthyphenmin|) and ρ = max(1,|\righthyphenmin|). (Plain TeX takes λ = 2 and ρ = 3.) Furthermore, the items immediately following the trial word must consist of zero or more characters, ligatures, and implicit kerns, followed immediately by either glue or an explicit kern or a penalty item or a whatsit or an item of vertical mode material from \mark, \insert, or \vadjust. Thus, a box or rule or math formula or discretionary following too closely upon the trial word will inhibit hyphenation. (Since TeX inserts empty discretionaries after explicit hyphens, these rules imply that already-hyphenated compound words will not be further hyphenated by the algorithm.)

An explicit hyphen is a character whose character code matches the font's \hyphenchar value or a ligature that ends with such a character (that's why also -- or --- inhibit hyphenation).

Indeed, if you try the following example, you'll see that TeX hyphenates the compound word:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\begin{document}
\hyphenchar\font=\string"7F

\parbox{1pt}{In Baden-W\"urttemberg}

\end{document}

The result is

In
Ba-
den-Würt-
tem-
berg

The T1 encoded fonts have in position 0x7F a character which is identical to the normal hyphen. Changing the \hyphenchar to denote this slot, the normal hyphen does not inhibit hyphenation any more.

share|improve this answer
1  
8 consecutive lines with hyphenated words in the TeXbook (the mentioned paragraph). That should be worth a Knuth-error-award-cheque. –  topskip Jul 13 '12 at 19:55
    
@PatrickGundlach Read at the bottom of page 451. :) –  egreg Jul 13 '12 at 19:59
    
Thanks a lot for answer & comment :) –  topskip Jul 13 '12 at 20:03
    
This solution works fine for me if I just load fontenc with the T1 encoding so that it uses cm-super. However, if I load lmodern as well, for example, it doesn't seem to work. Looking at the encoding files, both seem to put hyphen.alt in that spot. Does anybody know why it doesn't work with lmodern? –  cfr Nov 26 '13 at 23:07
1  
@egreg Am I right that changing \hyphenchar ist not really a practical »solution«? One would need to change it for all fonts and fonts series in use to get uniform behaviour for a document... (and still a "= may be needed in Baden-Württemberg so there isn't much gained when typing, anyway) –  cgnieder Feb 27 at 11:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.