Fix line breaking, punctuation kerning and font switching with non-tex-fonts

Use "luatexja" or "xeCJK" with non-tex fonts in
Japanese and Chinese example documents.
This commit is contained in:
Günter Milde 2019-01-28 22:11:43 +01:00
parent 34f5ba3c54
commit d6aec0dd33
3 changed files with 61 additions and 13 deletions

View File

@ -10,6 +10,16 @@
\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
\end_preamble
\use_default_options true
\maintain_unincluded_children false
@ -17,9 +27,9 @@
\language_package default
\inputencoding utf8-cjk
\fontencoding auto
\font_roman "default" "Noto Serif CJK SC"
\font_sans "default" "Noto Sans CJK SC"
\font_typewriter "default" "Noto Sans Mono CJK SC"
\font_roman "lmodern" "WenQuanYi Micro Hei"
\font_sans "default" "WenQuanYi Micro Hei"
\font_typewriter "default" "WenQuanYi Micro Hei Mono"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false

View File

@ -14,6 +14,18 @@
\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
\end_preamble
\options cjk
@ -23,9 +35,9 @@
\language_package default
\inputencoding utf8-cjk
\fontencoding auto
\font_roman "default" "Noto Serif CJK SC"
\font_sans "default" "Noto Sans CJK SC"
\font_typewriter "default" "Noto Sans Mono CJK SC"
\font_roman "lmodern" "WenQuanYi Micro Hei"
\font_sans "default" "WenQuanYi Micro Hei"
\font_typewriter "default" "WenQuanYi Micro Hei Mono"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false

View File

@ -6,9 +6,26 @@
\origin /systemlyxdir/examples/ja/
\textclass article
\begin_preamble
% CJKutf8 (4.8.4) maps the Greek letter mu to a mathematical (italic)
% symbol $\mu$ unless the package "textcomp" is loaded.
\usepackage{textcomp}
\usepackage{ifxetex}
\ifxetex
\usepackage{xeCJK}
\setCJKmainfont{IPAexMincho}
\setCJKsansfont{IPAexGothic}
\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}
% use Mainfont (DejaVu) for Greek and Cyrillic:
\ltjsetparameter{jacharrange={-2}}
%\usepackage[match]{luatexja-fontspec}
%\setmainjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
%\setsansjfont[Mapping=tex-text]{WenQuanYi Micro Hei}
%\setmonojfont{WenQuanYi Micro Hei Mono}
\fi
\end_preamble
\use_default_options false
\begin_modules
@ -19,9 +36,9 @@ logicalmkup
\language_package auto
\inputencoding utf8-cjk
\fontencoding auto
\font_roman "DejaVuSerif" "IPAMincho"
\font_sans "default" "IPAGothic"
\font_typewriter "default" "default"
\font_roman "DejaVuSerif" "DejaVu Serif"
\font_sans "DejaVuSans" "DejaVu Sans"
\font_typewriter "DejaVuSansMono" "DejaVu Sans Mono"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
@ -194,6 +211,15 @@ Libertine
work).
\end_layout
\begin_layout Itemize
\noindent
\lang english
Alternatively, you can use non-TeX fonts with xeCJK (XeTeX) or luatexja
(LuaTeX).
See the document preamble for an example.
\end_layout
\begin_layout Standard
\lang english