I want to set an automatic hyphenation for the Armenian word յանդգնել in XeLaTeX with \discretionary. The problem is, that there are four consonants in a row, and the Armenian language has very strange (for English speakers) rules about hyphenating such words. That word can hyphenated in two ways: յան֊դըգնել and յանդըգ֊նել, in both of them the letter ը reappears where it sounds. This can be correctly achieved with


where I've defined \h as


but there are nested \h-s here, so it gives an error

Improper discretionary list. ... յան\h{֊}{դըգ}{դ\h{ըգ֊}{}{գ}}

and the compiler (XeLaTex) just removes the second \h where it is needed.

I've found nothing about this topic in the Internet, and, unfortunately, there is no automatic hyphenation package for the Armenian language. What's wrong in nested \discretionary-ies?

P.S. Armenian uses another sign for hyphenation (a slightly curved ֊, not -), so I need to use \discretionary anyway.

  • Redefining \hyphenchar will not help. When the word is hyphenated, ը reappears in դըգ syllable, regardless of whether it is after or before the hyphenation sign, but when it is not, that ը is not written. Just redefining will not control ը.
    – Quaternion
    Oct 15, 2020 at 20:15
  • Yes I was just commenting on your PS that said you needed to use \discretionary as you were not using the ascii hyphen but that shouldn't be the case. (you might need it for other reasons of course). But to your main question oh I see you want something like abc-Nnq-xyz except that if there is no break at all then it is abcnqxyz with no N,at all, hmmm luatex might be easier than xetex here Oct 15, 2020 at 20:23

1 Answer 1


As you've seen nested \discretionaryies are not supported in TeX but as a workaround you can use that in most documents every line will have more than five characters, therefore it is unlikely that both hyphenation opportunities are taken. So usually you can archive your goal with


Of course this technically allows the (wrong) hyphenation


but under normal linelengths this is unlikely to be chosen because "դըըգ֊" is far from filling a line.

If you don't want to make such a compromise, you need LuaTeX. While LuaTeX doesn't support nested discretionaries in general either, it does support one special case which should be applicable here: Use

    local last = tex.nest.top.tail
    last.subtype = 5
    last.prev.subtype = 4



represents the "nested discretionaries"

  • Thanks, it worked!
    – Quaternion
    Oct 16, 2020 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.