3

When I set Chinese using babel and LuaLaTeX, I often find a line break inserted after :“. This looks weird to me and I'd prefer the break to come after the and before the .

Can I tweak some babel option or TeX setting to discourage this behaviour?

Here's a MWE demonstrating the weird break in the first paragraph and how I'd like it to automatically look in the second paragraph (without manually inserting \break).

%! TeX Program = lualatex

\documentclass{article}

\usepackage{babel}
\babelprovide[import,main]{chinese-simplified}
\babelfont{rm}{Noto Serif CJK SC}

\begin{document}

\hsize 1.85in
魔鬼又带他上了一座最高的山,将世上的万国与万国的荣华都指给他看,对他说:“你若俯伏拜我,我就把这一切都赐给你。”

魔鬼又带他上了一座最高的山,将世上的万国与万国的荣华都指给他看,对他说:\break “你若俯伏拜我,我就把这一切都赐给你。”

\end{document}

output

1 Answer 1

4

I've edited the original answer because there is a better option:

\documentclass{article}

\usepackage{babel}
\babelprovide[import,main,intraspace=0 .15 0]{chinese-simplified}
\babelfont{rm}{NotoSerifCJKsc-Regular.otf}

\babelcharproperty{`“}{linebreak}{op}

This sets the linebreak property of “ to ‘opening’, which forbids a line break after this character.

Original answer

Perhaps the simplest way is with a transform. It requires a recent version and you may need to increase slightly the intraspace (the default value is 0 .1 0, which is in em units). The following preamble works for me:

\documentclass{article}

\usepackage{babel}
\babelprovide[import,main,intraspace=0 .15 0]{chinese-simplified}
\babelfont{rm}{NotoSerifCJKsc-Regular.otf}

\babelprehyphenation{chinese-simplified}{:“}{
  {},  % Keep :
  {insert, penalty=-100},
  {}   % Keep “
}

2
  • Very nice (although I would never have got that from the babel docs). Is this something that should be set by default for Chinese in babel? I notice XeLaTeX renders my first paragraph the same as the second. Commented May 11, 2021 at 1:03
  • 1
    @DavidPurton I've opened an issue: github.com/latex3/babel/issues/131 . Commented May 11, 2021 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .