In Portuguese, we are supposed to add an hyphen at the beginning of the following line when hyphenation happened where there was already an hyphen. This is quite common because we use hyphens for enclitics (faz-se, for instance) and prefixes (e.g. pós-moderno), this rule was optional and is now coming back as a requirement.
To clarify, if faz-se gets hyphenated, one line will end in faz- and the following one will begin with -se.
All solutions I found call for either reverting back to Babel, or migrating to LuaLaΤεχ, or search and replacing existing hyphens, or some combination thereof. Is there a way to customize Polyglossia, or XəLaΤεχ, to just do the right thing?
Tried:
\documentclass {scrbook}
\usepackage {interchar, polyglossia}
\setlength\textwidth{8cm}
\setmainlanguage {brazil}
\begin {document}
\newintercharclass {\myclass}
\intercharclass {`\-} {\myclass}
\interchartoks {\myclass} {0} {\discretionary {} {-} {}}
\intercharstate {1}
intimidá-la-emos intimidá-la-emos intimidá-la-emos intimidá-la-emos
intimidá-la-emos intimidá-la-emos intimidá-la-emos intimidá-la-emos
\end {document}
Error, presumably because interchar does not like XəΤεχ:
Runaway argument?
! Forbidden control sequence found while scanning use of \cs_generate_variant:N
n.
<inserted text>
\par
l.31 \cs_generate_variant:Nn \int_to_hexadecimal:n
{ V }
interchartoks:
\documentclass {scrbook}
\usepackage {polyglossia}
\setlength\textwidth{8cm}
\setmainlanguage {brazil}
\begin {document}
\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\hyphclass
\newXeTeXintercharclass\letterclass
\XeTeXcharclass`\-=\hyphclass
\newcount\zz
\zz=`\A
\loop
\XeTeXcharclass\zz=\letterclass
\advance\zz 1
\unless\ifnum\zz>`\z
\repeat
\def\zzz-{\discretionary{-}}{-}{-}}
\XeTeXinterchartoks\letterclass\hyphclass{\zzz}
intimidá-la-emos intimidá-la-emos intimidá-la-emos intimidá-la-emos
intimidá-la-emos intimidá-la-emos intimidá-la-emos intimidá-la-emos
\end {document}
Result:
Only the first line break gets the additional hyphen. Presumably because á is not included between A and z. How could I include accented characters in the loop?
-
as a normnal letter and then have hyphenation rules that allow hyphenation following-
, or make-
active and expanding to a discretionary with two - - or use xetex interchartoks to insert a discretionary hyphen after-
! Undefined control sequence. l.3 \newintercharclass