6

I am trying to make ConTeXt to do the automatic discretionary hyphenations native to the Hungarian language.

In fact, a Hungarian word asszonnyal is explicitly included in lang-hyp.lua source code's comment section at the top: It should be hyphenated as asz-szony-nyal. Note that ssz becomes sz-sz when hyphenated and same happens with nny.

Unfortunately it does not apply when typesetting Hungarian text:

\setuppapersize[A9]
\mainlanguage[hu]
\setuphyphenation[method=traditional]
\setuppagenumbering[location=]

\starttext
Xxxxxx asszonnyal

Xxxxxx a\discretionary{sz-}{sz}{ssz}o\discretionary{ny-}{ny}{nny}al
\stoptext

Enter image description here

Note that method=default and method=expanded yields the same result.

As a workaround one can add \discretionary calls to the needed places.

This problem has also not been solved in LaTeX (magyar.ldf) which uses an active character before doubled multicharacter consonants to indicate the correct hyphenation rule.

As ConTeXt/LuaTeX seems to have more capabilities than LaTeX I wonder whether I can finally write in Hungarian and assume correct hyphenation of doubled multicharacter consonants as those are common in our language? Surely there are exceptions which require human attention but dealing with exceptions only would be timesaving.

Even better would be to have them in the hyphenation patterns somehow.

How can I make the common hyphenation mechanism to hyphenate this word correctly by default? Plus, how can I also add the exceptional word leggyakoribb to the hyphenation patterns of ConTeXt as well which should be hyphenated as leg-gyakoribb instead of legy-gyakoribb?

2 Answers 2

5

Below is the ConTeXt version of Ulrikes solution which uses LuaTeX’s extension of the \hyphenation command to set \discretionary values in the argument of the command.

\startexceptions[hu]
a{sz-}{sz}{ssz}o{ny-}{ny}{nny}al
\stopexceptions

\starttext

\starttabulate[|l|p(1pt)|]
\NC English   \EQ              asszonnyal \NC\NR
\NC Hungarian \EQ \language[hu]asszonnyal \NC\NR
\stoptabulate

\stoptext

Hyphenation exception with ConTeXt

2
  • Thanks. This gets me a little closer. However, probably I was not clear enough, sorry for that. See the last paragraph of the edited question. I wanted to signal that this word should be not an exception and be part of the default Hungarian hyphenation patterns. How can I add it to there? Note though, that if I won't get an answer to that question, I will accept this one. Jun 25, 2017 at 4:05
  • 1
    @SzieberthAdam: If you want to add a number of single words as hyphenation exceptions, the way to go is to contact the hyphenation list/the maintainer of hyph-utf8 (ctan.org/pkg/hyph-utf8) so that they get added to hyph-hu.hyp.txt. Imho this is the source that context uses too to create its own lua version of the patterns (with mtxrun --script pattern). Jun 26, 2017 at 14:15
2

With luatex \hyphenation has an extended syntax and you can add the arguments of a \discretionary. With latex e.g. this works:

\documentclass{article}
\usepackage[hungarian]{babel}
\hyphenation{a{sz-}{sz}{ssz}o{ny-}{ny}{nny}al}

\textwidth=1pt
\begin{document}
asszonnyal
\end{document}

enter image description here

I don't know if this could be done in \patterns in a generic way (I thought yes, but I think I have misunderstood the docu here) to avoid to have to create long word lists. You could ask on the tex-hyphen mailing list: https://www.tug.org/mailman/listinfo/tex-hyphen or on the context list.

I also don't know how to convert my latex example to context. The contextgarden is a bit vage here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .