TeX - LaTeX Asked on May 11, 2021
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
յանh{֊}{դըգ}{դh{ըգ֊}{}{գ}}նել
,
where I’ve defined h
as
newcommand{h}[3]{discretionary{#1}{#2}{#3}}
,
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.
As you've seen nested discretionary
ies 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
յանh{֊}{դը}{դ}h{ըգ֊}{}{գ}նել
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
newcommandweirddisc[6]{%
discretionary{#1}{#2}{#3}discretionary{#4}{#5}{#6}%
directlua{
local last = tex.nest.top.tail
last.subtype = 5
last.prev.subtype = 4
}}
...
յանweirddisc{֊}{դըգ}{դգ}{դըգ֊}{}{դըգ-}նել
Here
weirddisc{1}{2}{3}{4}{5}{6}
represents the "nested discretionaries"
h{1}{h{4}{5}{2}}{h{6}{5}{3}}
Answered by Marcel Krüger on May 11, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP