在巴西葡萄牙语中,如何使用 Polyglossia 对已经带连字符的单词进行连字符连接时产生重复的连字符?

在巴西葡萄牙语中,如何使用 Polyglossia 对已经带连字符的单词进行连字符连接时产生重复的连字符?

在葡萄牙语中,当在已有连字符的地方发生连字符时,我们应该在下一行的开头添加连字符。这很常见,因为我们使用连字符来表示连字符(法兹,例如)和前缀(例如现代派),这条规则原本是可选的,现在重新成为一项要求。

需要澄清的是,如果法兹被连字符连接,一行将以faz-接下来的将以-se

我发现的所有解决方案都要求恢复到 Babel,或迁移到 LuaLaΤεχ,或搜索并替换现有连字符,或两者结合。有没有办法自定义 Polyglossia 或 XəLaΤεχ,以做正确的事情?

尝试过:

\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}

错误,大概是因为 interchar 不喜欢 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 }

图表间:

\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}

结果:

只有第一个换行符才会有额外的连字符。大概是因为A不包括在内A。我怎样才能在循环中包含重音字符?

答案1

这显示了一种可能的方法,使用 XeTeX 字符类将小写 ascii 字母后跟一个连字符替换为重复连字符的自由字符,这里只完成了从 a 到 z 的替换,但你可以将任何其他字母添加到\lettersclass

在此处输入图片描述

有和没有设置时的文本设置相同。

\documentclass{article}

\setlength\textwidth{8cm}

\begin{document}

abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
verylongword verylongword verylongword verylongword verylongword 
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
verylongword verylongword verylongword verylongword verylongword 
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
verylongword verylongword verylongword verylongword verylongword 
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long

\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{\textbf{-}}{\textbf{-}}{-}}

\XeTeXinterchartoks\letterclass\hyphclass{\zzz}

abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
verylongword verylongword verylongword verylongword verylongword 
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
verylongword verylongword verylongword verylongword verylongword 
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
verylongword verylongword verylongword verylongword verylongword 
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long
abcd-efg  foo-bar zzz-zz-zz somethinglong some-thing-long

\end{document}

相关内容