# [NTG-context] optional hyphenation patterns in ancient Greek

Arthur Reutenauer arthur.reutenauer at normalesup.org
Mon Mar 25 15:09:52 CET 2019

```	Dear Pablo,

Five months ago I sent you a private email with detailed explanations
of how you can achieve that in ConTeXt.  I suggest you go through that
first before we start talking about a new pattern set.  Here is the
email, with a few updates (the paragraph quoted at the top is by
myself).

----
Date: Thu, 25 Oct 2018 15:05:17 +0200
From: Arthur Reutenauer <arthur.reutenauer at normalesup.org>

>   In LuaTeX it’s now possible to inject patterns on the fly, at
> typesetting time. I admit to not knowing if ConTeXt has a special way to
> take advantage of that; it’s a simple command in pure LuaTeX.  It would
> also be necessary to change a few patterns in the current set, because
> they would interact badly with 2γ1μ.  More on that tomorrow.

OK, so here goes.

It is not possible to just use \patterns in the middle of a Mark IV
run, because Hans deactivates it (in lang-ini.mkiv) -- clearly a remnant
from Mark II, as in pdfTeX and XeTeX it would have resulted in an error;
in ConTeXt it just becomes a no-op, which thus shadows LuaTeX’s
behaviour that could actually have been useful.

The situation in Mark IV is documented in languages-mkiv.pdf which is
part of the distribution: Hans rewrote the whole hyphenation routine in
Lua in 2014, and users can switch to it with

The idea behind the name is apparently that the Lua code mimics the
“traditional” way implemented in the TeX engine, and Hans envisages that
other methods can be written in the future (but this hasn’t happened
yet).  The non-Lua method is on by default and can be chosen explicitly
with \setuphyphenation[method=default] but it is not possible to inject
new patterns that way because of the above.

With the Lua method activated, it becomes possible to add patterns on
the fly with

\registerhyphenationpattern[agr][2γ1μ]

Some care should be taken when adding patterns to an existing set, since
they can -- and in this case do -- interact with other patterns in the set.
Here, I’ve found that this row of patterns (l. 516 of the master file,
https://github.com/hyphenation/tex-hyphen/blob/82e5651/hyph-utf8/tex/generic/hyph-utf8/patterns/tex/hyph-grc.tex#L516):

4γμ' 4γμ’ 4γμʼ 4γμ᾽ 4γμ᾿

needs to be overridden with patterns such as

γ2μ' γ2μ’ γ2μʼ γ2μ᾽ γ2μ᾿

otherwise the new pattern would allow breaks before the mu.

The attached file puts everything together.
----

Best,

Arthur
-------------- next part --------------
A non-text attachment was scrubbed...
Type: text/x-tex
Size: 377 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20190325/e402ca00/attachment.tex>
-------------- next part --------------
A non-text attachment was scrubbed...