2

MWE

\documentclass{article}

\usepackage{xeCJK}
\usepackage[japanese]{babel}

\begin{document}
   \selectlanguage{japanese}
   日本語をををををををををををををををををををををををををををかいぎょうします。
\end{document}

In some typographical standards for Japanese, there are articles which state that the following characters cannot begin a line:

  • ぁぃぅぇぉ
  • ゃゅょ

etc.

Similarly, the following cannot end a line:

etc.

Babel's coverage of the above is incomplete: lines won't begin with 、 or 。, but will with ゃ, for example. I'm completely ignorant of how to edit the japanese.ldf file provided with Babel but I suppose that I need to:

  • change the hyphenation rules somehow, and
  • add some sort of exception so I don't get an overfull hbox every time LaTeX wants to break a line on one of the above characters.

<EDIT> A correct solution would be one where sequences like ぎ\nょ are changed to ぎょ\n. I.e., where the is kept on the previous line. This would create an overfull hbox, so an exception would have to be made. </EDIT>

Up to this point, I've just been inserting linebreaks to handle the second case. For the first case, I've tried inserting a zero width no-break space using symbol{"FEFF}, but (perhaps due to my font choice) this actually produces a space with some width (and still breaks due to the neighbouring characters being CJK). I've also tried putting the relevant characters in a \mbox{}, which works but is as laborious as manual linebreaking for large documents.

<EDIT> Another way to do this that is (only slightly) more flexible, is add \nolinebreak immediately before characters that cannot begin a line and add \linebreak[1] immediately before characters that cannot end a line. This is clearly still quite laborious. </EDIT>

Compiling with XeLaTeX (and BibTex), if that's relevant.

  • 1
    I'm a maintainer of japanese.ldf; it does not contain any settings related to Japanese typographical standards (called "kinsoku"). – Hironobu YAMASHITA Dec 9 '18 at 12:07
  • @HironobuYAMASHITA Thank you for letting me know what it's called (禁則)! It would seem like fixing this problem requires me to edit something other than japanese.ldf. Do you know where? – jamesh625 Dec 10 '18 at 5:13
  • The problem lies in xeCJK's feature, and there is no easy way to add such a setting. In fact, the previous version of xeCJK contained kinsoku parameters for small kana characters ("ょ" etc.), but those were removed to avoid a bug in inter-character spacing. (-> continue) – Hironobu YAMASHITA Dec 10 '18 at 11:40
  • (-> continue) In xeCJK, characters which require a special handling for typographic requirements are categorized into character classees. And, the individual character classes are associated with some parameters (including kinsoku, inter-character spacing, etc). Currently there is a class for punctuations ("、", "。", ...), but no class is pre-defined for small kana ("ょ", "っ", ...). I don't know how to add one, and I don't know even this is the right solution, sorry. – Hironobu YAMASHITA Dec 10 '18 at 11:46
  • @HironobuYAMASHITA Thanks, it's good to know that Babel is not the correct file to edit, at least. I suppose I should think about making some sort of macro which just inserts the \[no]linebreak commands silently before compilation. I'll post it here if I get around to it. – jamesh625 Dec 11 '18 at 7:40

Your Answer

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

Browse other questions tagged or ask your own question.