[tex-hyphen] German hyphenation of "Methode"

Hans Hagen pragma at wxs.nl
Fri Apr 10 02:28:25 CEST 2015


On 4/9/2015 8:48 PM, Philip Taylor wrote:
>
>
> Pablo Rodríguez wrote:
>
>> After the reply from Werner, I don’t know whether a \totalhyphenmin
>> would be useful in Spanish.
>>
>> I’m afraid that the first option (a list of 4-letter words that could be
>> hyphenated in Spanish) doesn’t solve the issue. I’d say it is the cause,
>> because both \lefthyphenmin and \righthyphenmin set to 2 hyphenates
>> 4-letter words. In general, I think that hyphenation of 4-letter words
>> should be avoided (or at least, in Spanish).
>
> So would not \(total)hyphenmin = 5 for Spanish address this ?
> ** Phil.

Speaking for luatex, I can remark that there is no real need to extend 
the engine so that is unlikely to happen (apart from the proposed 
penalty as that is a trivial one that is hard to achieve otherwise).

- there are numerous ways to deal with special cases in hyphenation cq. 
languages and covering all makes the now still largely tex compatible 
machinery fuzzy and bloated; no extension can cover all wishes anyway

- the whole idea behind luatex is that one can extend the core with own 
code, and the following function (simple version) demonstrates how to do 
it (plug it in after the hyphenation stage, I only tested it in context 
and it works ok but of course one can extend it with more clever 
features; for context users: if this is really needed i can add similar 
code someplace)

     local glyph = node.id("glyph")
     local disc  = node.id("disc")

     local limit    = 7
     local language = false -- 2

     function LimitHyphenation(head)
         local current = head
         local length  = 0
         local found   = false
         while current do
             if current.id == glyph then
                 if not language or current.lang == language then
                     length = length + 1
                 else
                     length = 0
                     found  = false
                 end
                 current = current.next
             elseif current.id == disc then
                 if current.subtype == 3 then
                     if not found then
                         found = { current }
                     else
                         found[#found+1] = current
                     end
                     current = current.next
                 else
                     length = 0
                     found  = false
                     current = current.next
                     while current do
                         if current.id ~= glyph then
                             break
                         else
                             current = current.next
                         end
                     end
                 end
             else
                 if found and length <= limit then
                     for i=1,#found do
                         local d = found[i]
                         node.remove(head,d)
                         node.free(d)
                     end
                 end
                 length = 0
                 found  = false
                 current = current.next
             end
         end
         return head
     end

- so, instead of extending the core engine, one should plug in code like 
this; how and what depends on the macro package (which is another reason 
for not hardcoding dozens of hyphenation strategies, parbuilder, and 
whatever); the core is the traditional tex engine which also serves as 
reference; a nice aspect is that writing such a function takes a 
fraction of the time to extend the engine

- i can come up with some other hyphenation demands (read: users and 
publishers do) but would never burden the core of luatex with it which 
is why in context much is delegated to lua (of course, when some 
specific access to internals is needed to achieve goals, then that will 
be considered by the team)

(fwiw, later this year, after the tl code freeze some more hyphenation 
related code will show up in context)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the tex-hyphen mailing list