# How do I wrap text that doesn't use SPACE character to segment word

As you know, there are many languages out there that don't use a SPACE character for word segmentation. For such language, special non-printable characters are used, such ZERO WIDTH NON JOINER or ZERO WIDTH SPACE characters.

It seems XeTeX or XeLaTeX depends on SPACE characters only for the wrapping behavior. Is there a way to change this behavior? Are there packages out there that may help in this? Say, be able to specify characters that Tex can use to determine where to wrap text? If not, I wonder if this is something one can develop?

Any pointers would be much appreciated!

-
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. –  adn Dec 14 '11 at 11:21
Did you consider the xeCJK package? –  egreg Dec 14 '11 at 11:49
I am not sure if I understand the question, an example might help. If I get it correctly, you want line breaks not only at spaces, luatex might be suitable. –  mbork Dec 14 '11 at 11:51

XeTeX has \XeTeXlinebreaklocale, followed by language code, to set language specific line breaking behaviour, e.g. \XeTeXlinebreaklocale "zh" or\XeTeXlinebreaklocale "th" to set line breaking for Chinese or Thai, respectively.

Some languages have dedicated packages for XeLaTeX that handles this and more language specific stuff, like xeCJK.

-

For XeTeX, I suggest our xeCJK package. The package not only handle the line breaking, but also sets the fonts and takes care of the punctuations. See also How to write Japanese with LaTeX?. An example:

\documentclass{article}
\usepackage[BoldFont]{xeCJK} % compatible with some packages which relys on CJK
\usepackage{ruby}
\setCJKmainfont{MS Mincho} % Set a Japanese font you have
\setlength\parindent{2em}
\begin{document}
この FAQ リストは、よくある質問とその答を集め、役に立つよう
にしたものです。この FAQ リストの構造は、以前のものと比べて大幅に変更
されています。\textbf{\ruby{新}{あたら}しい構造に関しては、「この FAQ
の読み方とその構造」の項目を\ruby{参}{さん}\ruby{照}{しょう}して下さ
い。}
\end{document}


The low level solution is to use:

\XeTeXlinebreaklocale "ja"         % for Japanese
\XeTeXlinebreakskip 0pt plus 0.1pt % sets the skip

-

Using \XeTeXlinebreaklocale and \XeTeXlinebreakskip was the way to go. Specifically, for this post, I was dealing with Myanmar (Burmese) text. Applied "my" as locale for this language and set the XeTeXlinebreakskip option to 0pt plus 0.1pt, which took care of the orphaned punctuation marks.

-