[latex3-commits] [git/LaTeX3-latex3-babel] docs: Chinese. Thai line breaking. (39fe5c3)

Javier email at dante.de
Sun Jul 4 12:53:33 CEST 2021


Repository : https://github.com/latex3/babel
On branch  : docs
Link       : https://github.com/latex3/babel/commit/39fe5c349cda224ec221f9e39689dd9e83eb9038

>---------------------------------------------------------------

commit 39fe5c349cda224ec221f9e39689dd9e83eb9038
Author: Javier <email at localhost>
Date:   Sun Jul 4 12:53:33 2021 +0200

    Chinese. Thai line breaking.


>---------------------------------------------------------------

39fe5c349cda224ec221f9e39689dd9e83eb9038
 docs/_includes/menu.html      |   1 +
 docs/guides/locale-chinese.md |  56 ++++++++++++++++++++++++++++++++++++++++++
 docs/guides/locale-thai.md    |  22 +++++++++++++++++
 docs/media/chinese-sample.png | Bin 0 -> 94375 bytes
 4 files changed, 79 insertions(+)

diff --git a/docs/_includes/menu.html b/docs/_includes/menu.html
index 5a7af11..6855a33 100644
--- a/docs/_includes/menu.html
+++ b/docs/_includes/menu.html
@@ -54,6 +54,7 @@
       <ul>
         <li><a href="https://latex3.github.io/babel/guides/locale-arabic.html">Arabic</a></li>
         <li><a href="https://latex3.github.io/babel/guides/locale-bengali.html">Bengali</a></li>
+        <li><a href="https://latex3.github.io/babel/guides/locale-chinese.html">Chinese</a></li>
         <li><a href="https://latex3.github.io/babel/guides/locale-czech.html">Czech</a></li>
         <li><a href="https://latex3.github.io/babel/guides/locale-hebrew.html">Hebrew</a></li>
         <li><a href="https://latex3.github.io/babel/guides/locale-hindi.html">Hindi</a></li>
diff --git a/docs/guides/locale-chinese.md b/docs/guides/locale-chinese.md
new file mode 100644
index 0000000..2502bb0
--- /dev/null
+++ b/docs/guides/locale-chinese.md
@@ -0,0 +1,56 @@
+# Chinese
+
+Chinese is available for `xetex` and `luatex`. With the latter, both
+renderers (the default and Harfbuzz) are fine.
+
+Note the best option is usually to resort to a dedicated framework like
+[CTeX](https://ctan.org/pkg/ctex), [CJK](https://ctan.org/pkg/cjk) or
+[ChineseJFM](https://ctan.org/pkg/chinese-jfm). However, for simple
+documents in horizontal writing, as well as a few words or sentences in
+a multilingual document, `babel` should be enough.
+
+Here is a short example:
+```tex
+\documentclass{book}
+
+\usepackage[chinese, provide=*]{babel}
+
+\babelfont{rm}{FandolSong}
+
+\begin{document}
+
+\chapter{天山山脉}
+
+位于乌鲁木齐市以东的博格达峰海拔5445米,峰上的积雪终年不化,人们称它“雪海”。位于博格达峰山腰的天池,清澈透明,是新疆著名的旅游胜地。目前,博格达峰自然保护区已纳入联合国“人与生物圈”自然保护区网。托木尔峰,海拔7439米,是天山的最高峰,登山界一般承认1956年阿巴拉科夫首次登顶成功,但也有说1938年已有苏联登山队登顶;1975年7月25日首个中国登山队登顶成功。
+
+\end{document}
+```
+
+![](../media/chinese-sample.png)
+
+## Line breaking
+
+Rules are harcoded in XeTeX, but in LuaTeX a line breaking mechanism
+has been devised, based on (but not strictly following) the Unicode
+algorithm.
+
+Justification in both engines is controlled by a couple of options in
+`\babelprovide`.
+
+* `intraspace` sets the inner spaces in em units (so, `0 .1 0` is 0em
+  plus .1em). The em unit applied is that of the current text (more
+  precisely, the previous glyph).
+* `intrapenalty` sets the inner penalty of the breaking opportunities.
+
+There is in addition the posibility to change globally the line
+breaking class, with, for example:
+```tex
+\babelcharproperty{`“}{linebreak}{op}
+\babelcharproperty{`”}{linebreak}{cl}
+```
+   
+For the meaning of these codes, see the [Unicode Standard Annex #14:
+Line Breaking
+Properties](http://unicode.org/reports/tr14/tr14-14.html).
+
+
diff --git a/docs/guides/locale-thai.md b/docs/guides/locale-thai.md
index 7e0e466..ba430f3 100644
--- a/docs/guides/locale-thai.md
+++ b/docs/guides/locale-thai.md
@@ -8,5 +8,27 @@ There is a complete example (with `microtype`) in the repository
 ([tex](https://github.com/latex3/babel/blob/main/samples/lua-thai.tex), 
 [pdf](https://github.com/latex3/babel/blob/main/samples/lua-thai.pdf)).
 
+
 ![](../media/lua-thai.png)
 
+## Line breaking
+
+Rules are harcoded in XeTeX, but in LuaTeX the standard hyphenation
+mechanism is used, son that you can load different rules or fine tune the
+loaded ones with `\babelpatterns` (or even a transform).
+
+With XeTeX, `babel` attempts to get rid of hyphen chars at the end of
+lines, but due to the limitations of this engine it sometimes fails.
+With LuaTeX there shouldn’t be any problems.
+
+Justification in both engines is controlled by a couple of options in
+`\babelprovide`.
+
+* `intraspace` sets the inner spaces in em units (so, `0 .1 0` is 0em
+  plus .1em). Like `\spaceskip`, the em unit applied is that of the
+  current text (more precisely, the previous glyph).
+* `intrapenalty` sets the inner penalty of the breaking opportunities.
+   
+
+
+
diff --git a/docs/media/chinese-sample.png b/docs/media/chinese-sample.png
new file mode 100644
index 0000000..bca3ce6
Binary files /dev/null and b/docs/media/chinese-sample.png differ





More information about the latex3-commits mailing list.