]> git.lyx.org Git - features.git/commitdiff
Chinese localization in user preamble using "ctex" with non-TeX fonts
authorGünter Milde <milde@lyx.org>
Tue, 29 Jan 2019 21:31:58 +0000 (22:31 +0100)
committerGünter Milde <milde@lyx.org>
Tue, 29 Jan 2019 21:31:58 +0000 (22:31 +0100)
https://tex.stackexchange.com/questions/17611/how-does-one-type-chinese-in-latex

TODO: use "ctex" if the document language is Chinese.

Remove "\clearpage" workaround from documents
(not required after fix for #5386 in [5ebc0b3f432f468/lyxgit]).

development/autotests/unreliableTests
lib/doc/zh_CN/Intro.lyx
lib/doc/zh_CN/Tutorial.lyx

index 96a644b0c8275ec5faa8c5a523305eb55b0cb216..9b1a875d4933bc8e8f8d3e6c5200c127ecb1301b 100644 (file)
@@ -121,9 +121,10 @@ export/templates/acmart_pdf
 # the name of the day in English instead of Japanese.
 export/examples/ja/multilingual_lyx.*
 
-# No localization of auto-strings with Chinese language (LyXHTML is OK)
+# No localization of auto-strings with Chinese language under 8-bit TeX
+# (ctex font issue with texlive-lang-chinese (from Debian) under pdflatex):
 export/export/latex/CJK/zh_CN-toc.*
-export/doc/zh_CN/(Intro|Tutorial)_(dvi|pdf).*
+export/doc/zh_CN/(Intro|Tutorial)_(dvi|pdf).?
 
 # Missing Chinese characters in the DVI (LuaTex)
 export/doc/zh_CN/(Intro|Tutorial)_dvi3_systemF
index 8e17f5383bf8e9b5ed6d9bed7313dd79a6579cb5..46321bd2559ce5d2a4793ff1a61bf1f45f18dd76 100644 (file)
@@ -6,20 +6,11 @@
 \origin /systemlyxdir/doc/zh_CN/
 \textclass article
 \begin_preamble
-\usepackage{ifxetex}
-\ifxetex
-\usepackage{xeCJK}
-\fi
-
-% proper line breaking, punctuation kerning and font switching
-% features with LuaTeX
-% see https://tex.stackexchange.com/questions/222980/how-to-use-chinese-with-lualatex
-\usepackage{ifluatex}
-\ifluatex
-  \usepackage{luatexja-fontspec}
-  \setmainjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
-  \setsansjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
-\fi
+% Chinese localization
+\@ifpackageloaded{fontspec}%
+{\usepackage{ctex}}% ctex with non-TeX fonts
+{%\usepackage[UTF8]{ctex}% error with font setup (missing font?)
+}
 \end_preamble
 \use_default_options true
 \maintain_unincluded_children false
@@ -1500,26 +1491,5 @@ literal "false"
 无论你修改文档的想法是什么,只要它能够改善文档质量,我们都是乐于接受的。
 \end_layout
 
-\begin_layout Standard
-\begin_inset Note Note
-status open
-
-\begin_layout Plain Layout
-The following clearpage is required to avoid compilation errors at some
- installations for an unknown reason.
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
-\begin_layout Standard
-\begin_inset Newpage clearpage
-\end_inset
-
-
-\end_layout
-
 \end_body
 \end_document
index 9300934551df3da91f426ec9fa2d85f23aa84dad..44f6cded94e7d70f9aba1995a6a441b5ee117b68 100644 (file)
@@ -6,27 +6,11 @@
 \origin /systemlyxdir/doc/zh_CN/
 \textclass book
 \begin_preamble
-%\usepackage{fontspec}
-%\setromanfont{AR PL ShanHeiSun Uni}%字体来自Adobe Reader 8.0 OpenType,可以选用任何系统已有的字体
-%中文断行 
-%\XeTeXlinebreaklocale "zh"
-%\XeTeXlinebreakskip = 0pt plus 1pt 
-\usepackage{ifxetex}
-\ifxetex
-  \usepackage{xeCJK}
-  %\setCJKmainfont{WenQuanYi Micro Hei}
-  %\setCJKmonofont{WenQuanYi Micro Hei Mono}
-\fi
-
-% proper line breaking, punctuation kerning and font switching
-% features with LuaTeX
-% see https://tex.stackexchange.com/questions/222980/how-to-use-chinese-with-lualatex
-\usepackage{ifluatex}
-\ifluatex
-  \usepackage{luatexja-fontspec}
-  \setmainjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
-  \setsansjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
-\fi
+% Chinese localization
+\@ifpackageloaded{fontspec}%
+{\usepackage{ctex}}% ctex with non-TeX fonts
+{%\usepackage[UTF8]{ctex}% error with font setup (missing font?)
+}
 \end_preamble
 \options cjk
 \use_default_options true
@@ -2963,21 +2947,5 @@ Bib\SpecialChar TeX
  错误信息。
 \end_layout
 
-\begin_layout Standard
-\begin_inset ERT
-status open
-
-\begin_layout Plain Layout
-
-
-\backslash
-clearpage
-\end_layout
-
-\end_inset
-
-
-\end_layout
-
 \end_body
 \end_document