1

I have been attempting to create a double column report style for Thai documents but had a difficult time trying to find documentation. So we did stumble on a hint for inserting intercharacter after reading through the XeTeX reference guide.

\XeTeXlinebreaklocale "th-TH"
\XeTeXlinebreakskip=0.0pt plus 0.1pt

It is instructive to also show our first approach which totally failed but helped to illustrate the nature of XeTeX in dealing with Thai characters. We attempted to divide the Thai letters into 2 classes those that require a space before them and those that are "diacritics" and do not require intercharacter space:

\XeTeXinterchartokenstate=1
\chardef\CharNormal=0
\newXeTeXintercharclass\CharThai
\XeTeXcharclass`ก=\CharThai  \XeTeXcharclass`ข=\CharThai
\XeTeXcharclass`ฃ=\CharThai  \XeTeXcharclass`ค=\CharThai
\XeTeXcharclass`ฅ=\CharThai  \XeTeXcharclass`ฆ=\CharThai
\XeTeXcharclass`ง=\CharThai  \XeTeXcharclass`จ=\CharThai
\XeTeXcharclass`ช=\CharThai  \XeTeXcharclass`ฌ=\CharThai
\XeTeXcharclass`ญ=\CharThai  \XeTeXcharclass`ฎ=\CharThai
\XeTeXcharclass`ฏ=\CharThai  \XeTeXcharclass`ฐ=\CharThai
\XeTeXcharclass`ฑ=\CharThai  \XeTeXcharclass`ฒ=\CharThai
\XeTeXcharclass`ณ=\CharThai  \XeTeXcharclass`ด=\CharThai
\XeTeXcharclass`ต=\CharThai  \XeTeXcharclass`ถ=\CharThai
\XeTeXcharclass`ท=\CharThai  \XeTeXcharclass`ธ=\CharThai
\XeTeXcharclass`น=\CharThai  \XeTeXcharclass`บ=\CharThai
\XeTeXcharclass`ป=\CharThai  \XeTeXcharclass`ผ=\CharThai
\XeTeXcharclass`ฝ=\CharThai  \XeTeXcharclass`พ=\CharThai
\XeTeXcharclass`ฟ=\CharThai  \XeTeXcharclass`ภ=\CharThai
\XeTeXcharclass`ม=\CharThai  \XeTeXcharclass`ย=\CharThai
\XeTeXcharclass`ร=\CharThai  \XeTeXcharclass`ล=\CharThai
\XeTeXcharclass`ว=\CharThai  \XeTeXcharclass`ศ=\CharThai
\XeTeXcharclass`ษ=\CharThai  \XeTeXcharclass`ส=\CharThai
\XeTeXcharclass`ห=\CharThai  \XeTeXcharclass`ฬ=\CharThai
\XeTeXcharclass`อ=\CharThai  \XeTeXcharclass`ะ=\CharThai
\XeTeXcharclass`า=\CharThai  \XeTeXcharclass`โ=\CharThai
\XeTeXcharclass`ไ=\CharThai  \XeTeXcharclass`ใ=\CharThai
\XeTeXinterchartoks\CharNormal\CharThai={\hskip 0pt plus 0.2pt\relax}
\XeTeXinterchartoks\CharThai\CharThai={\hskip 0pt plus 0.2pt\relax}

While this provided intercharacter spacing before every consonant and non-overlapping vowel it also destroyed hyphenation by encouraging breaks before every member of the \charThai class. However ligature combinations between consonants and subsequent overlapping vowels was preserved. Adding \nobreak destroyed all breaks before strings of Thai characters.

The take-home message for us is because inserting intercharacter tokens will destroy the support for Thai hyphenation it should be used very sparingly (such as spacing around ๆ and ฯ).

rbatz
  • 11
  • 1
  • 1
    Welcome to TeX.SE! Is there a question here, or were you just sharing what you found? (It's ok if it's the latter; in that case to fit the format of the site you just have to phrase it as a question and post whatever you're sharing as an answer.) – ShreevatsaR Feb 15 '18 at 05:04
  • Would this problem still persist if you use \kern instead of \hskip? But, I assume that hyphenation will be prevented almost everywhere then. – Jasper Habicht Feb 15 '18 at 07:05

0 Answers0