17

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!

  • 1
    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
  • 3
    Did you consider the xeCJK package? – egreg Dec 14 '11 at 11:49
  • 1
    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
16

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.

9

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
5

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.

0

Similar to @Yasutaka 's answer, I used:

\XeTeXlinebreaklocale "my"
\XeTeXlinebreakskip = 0pt plus 2.5pt
\setmainfont[Script=Myanmar]{Padauk} %for those of you dealing specifically with a Myanmar/Burmese-related issue.

Keeping the line break skip at 0 plus 0.1 still left me with a few problems. Going up to plus 2 got rid of all but two instances, hence 2.5pt. Again, for those looking for Myanmar-specific help, I made the mistake of starting with Myanmar Font, not Padauk. The former is a ttf font, Padauk is Open Type, which makes all the difference in this situation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.