This question has a follow-up question, namely: "Change letter-spacing / tracking for punctuation marks (luatexja-fontspec)".
Imagine you are working in LuaLaTeX, and you want to use Chinese texts (often featuring long series of characters without spaces) to break across lines, so that the end-user can actually still read them. How would you do this?
According to an answer to the OP "How to use Chinese with lualatex?", one can simply use:
\usepackage{luatexja-fontspec}
However. This seems to overrule the use of a user-specified font, as would normally be customized by:
\setmainfont{
...}
So my question is, in LuaLaTeX, how to both be able to:
- specify a custom font for the whole document,
- let the Chinese text line-break so as to make it readable?
MWE (to be compiled with LuaLaTeX)
\documentclass[a4paper, fontsize=30pt]{scrreprt}
\usepackage{fontspec}
\setmainfont{HanWangKaiMediumChuIn_wp010-08}
\begin{document}
勞碌奔波、勉強應付。《京本通俗小說.錯斬崔寧》:「光陰迅速,大娘子在家巴巴結結,將近一年,父親見他守不過,便叫家裡老王去接他來。」也作「巴巴急急」、「巴巴劫劫」、「波波劫劫」、「劫劫巴巴」、「劫劫波波」、「結結巴巴」。
\end{document}
- Note: This MWE uses a custom font, namely HanWangKaiMediumChuIn_wp010-08.ttf, so one needs to to download it and install it in case one wishes to use the same.
P.S.: According to the luatexja-package documentation, changing the default fonts should be possible (e.g. using \def\ltj@stdmcfont{psft:
...}
), but I have not been able to do so. Perhaps this option is restricted to fonts which are part of the luatexja-package?
P.P.S: \usepackage{seqsplit}
(see e.g. this answer to the OP "Automatic line breaking of long lines of text?") also doesn't seem to work for Chinese text.
luatexja
package is set to deal with Japanese text. Japanese texts, almost invariably, contain a mixture of kanjis (Chinese characters) and hiragana and katakana glyphs. Are you looking for a solution that deals exclusively with Chinese glyphs/characters, or will it be a mixture of kanji and kana glyphs? – Mico Oct 1 '17 at 6:37luatexja
package as per the mentioned answer to another OP, in which it was (simplistically) argued that: "the tools designed for Chinese and Japanese usually work the same." – O0123 Oct 1 '17 at 6:39\usepackage{luatexja-fontspec}\setmainjfont{Microsoft YaHei}
as suggested by @Mico works fine for me (at least I get line breaks, but I have no idea if they are sensible). – Ulrike Fischer Oct 1 '17 at 10:08