# Hyphenation penalty

Say I have done `\hyphenation{a-no-ma-ly}`. In the text, the word is broken ano-maly. This is (etymologically) displeasing, but may be better than the spacing that would result from barring it. Can I do something in the text to penalize this break? I tried `… ano\penalty100maly`, but that just produced a break with no hyphen.

PS: Is there no way to use `\penalty` (or something) with discretionary hyphens? Could one, for instance, redefine `\-` to work like this: `a\-1no\-2ma\-1ly`?

• Are you trying to impose higher penalties for some hyphenation break points and lower penalties for others? – Mico Sep 12 '15 at 11:12
• Yes. (In this case, I would say both alternatives, though bad, are better than ano-maly.) – Toothrot Sep 12 '15 at 11:24

Not in `\hyphenation`, this is a well known limitation of tex. It most often comes up for languages with lots of compound words where it would be good (but not possible) to prefer breaking between the compounds.

Also with the default settings of `\lefthyphenmin` and `\righthyphenmin` for English TeX will not use `a-nomaly` or `anoma-ly` so `\hyphenation{a-no-ma-ly}` is the same as `\hyphenation{ano-maly}`.

Within the text, in a given instance you can of course manually break anywhere

For example:

Forced break:

``````... an-\linebreak
omaly ...
``````

or explicit discretionary:

``````... an\-omaly
``````

The precedence for hyphenation selection is (1) explicit discretionaries within the word in text; (2) a pattern specified in the `\hyphenation` list (which can be limited to a particular language); (3) the specified patterns for the current language.

• Can it not be done manually for a single occurrence either? – Toothrot Sep 12 '15 at 11:41
• (My impression is that `a\-no\-ma\-ly` would break at the first discretionary that does not produce a badness of 10000 (?)) – Toothrot Sep 12 '15 at 11:52
• @Lawrence yes, the initial text just discussed automatic hyphenation, but the answer now clarifies (I hope) that you can break within the text. `a\-no\-ma\-ly` could break at any of those (not necessarily the first, whichever leads to the lowest overall badness for the paragraph) – David Carlisle Sep 12 '15 at 11:57
• Excellent, thank you. I have the feeling I have seen earlier that manual discretionaries produce other results than automatic `\hyphenation{}`, so I concluded they take the first acceptable; but maybe it was something else. – Toothrot Sep 12 '15 at 12:04
• the precedence for hyphenation selection is (1) explicit discretionaries within the word in text; (2) a pattern specified in the `\hyphenation` list (which can be limited to a particular language); (3) the specified patterns for the current language. (@DavidCarlisle -- why don't you add this to your answer.) – barbara beeton Sep 12 '15 at 12:47