# [tex-hyphen] String preparation

Hans Hagen pragma at wxs.nl
Fri May 27 11:14:16 CEST 2016

```On 5/27/2016 10:03 AM, Élie Roux wrote:
> Hi,
>
>> we don't want to complicate the machinery any more than it is already
>> is but i realized that these can be achieved rather simple by messing
>> with the (new) hjcodes, so i played with that a bit last night.
>
> Thanks a lot, that looks very promising!
>
>> \hsize 1mm
>>
>> \hjcode`x=`o
>>
>> foobar % foo-bar
>>
>> fxxbar % fxx-bar
>>
>> \lefthyphenmin3
>>
>> œdipus % œdipus
>>
>> \hjcode`œ=1    % < 32 then it's the length and code is char code
>>
>> œdipus % œdi-pus
>
>
>    \lefthyphenmin3
>    œdipus
>
> give œdipus and not œdi-pus (which has 3 glyphs before the hyphen)?

a better example (with right patterns)

\fr

\hsize 1mm

\hjcode`x=`o

foobar % foo-bar

fxxbar % fxx-bar

\lefthyphenmin3

œdipus % œdi-pus

\lefthyphenmin4

œdipus % œdipus

\hjcode`œ=2    % < 32 then it's the length and code is char code

œdipus % œdi-pus

> Also, will this work with 0? For instance can we say
>
>    \hjcode`^^^^0301=0

hjcode accepts a number (as any code primitive), the ` just turn a
character into a number

> How does it work when it's chained? For instance, what if I want
>
> - ǽ (U+01FD) to be in the same class as æ
> - æ to have a length of 2
>
> ? Does it work with
>
> \hjcode`ǽ=æ
> \hjcode`æ=2
>
> ? Even if it doesn't, that covers many use cases so thanks!

indeed that is the limitation .. in that case either you use the hj code
for the class or for the length (i assume that the number of classes
with ae oe is pretty small esp when we consider them not to be that
similar) ... patterns are already obscure enough in order not to add yet
another level of complexity and as argued before have a few more
patterns is not a problem (one can always for more complex situationsn,
heuristics etc run over the list and mess with nodes)

Hans

-----------------------------------------------------------------