# [NTG-context] Hyphenation with apostrophes

Taco Hoekwater taco at elvenkind.com
Mon Dec 17 11:09:44 CET 2007


Zeus Gómez Marmolejo wrote:
> Hi,
>
> I'm writing a text in catalan language. Hyphenation patterns are loaded
> correctly, however when I want to write an apostrophed word, hyphenation
> doesn't work.
>
> For example, the word "instructions" is written "instruccions". When I
> want to say "of instructions" is "d'instruccions". Hyphenation rules in
> catalan work normally in this case, that is: "d'ins-truc-cions" but I
> see in context the whole word at the end of a column line surpassing the
> margin limits without hyphenation. I see that this is happening in all
> words beginning with contracted articles or prepositions like d' l' etc...
>
> How can I solve this,

At the tex level you need either

\lccode\'=\'

or make the ' an active character running a macro that is a bit like
||, e.g. this:

\catcode\'=\active
\unexpanded\def'{\string'\prewordbreak}

With the second solution, you have to be careful with your input
(active characters are always dangerout in the regard) but the
first solution has the downside that it decreases the \lefthyphenmin
by two:  d'ins-truc-cions then is a single word with 5-4-5 charachers
in it, and that may change hyphenation into e.g. d'i-ns-truc-cions.
Whether that is a problem depends on your actual language.

Best wishes,
Taco
`