From 63a2bf1ad66c853ca9858eec2ca115d3c2267f43 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 18 Aug 2013 23:36:18 +0000 Subject: xecjk (18aug13) git-svn-id: svn://tug.org/texlive/trunk@31466 c570f23f-e606-0410-a88d-b1316a301751 --- .../xecjk/example/xeCJK-example-autofake.tex | 4 +- Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf | Bin 935988 -> 945831 bytes Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx | 630 ++++++++++++--------- Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins | 4 +- .../texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg | 4 +- .../tex/xelatex/xecjk/xeCJK-listings.sty | 6 +- Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 372 ++++++------ Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty | 7 +- .../tex/xelatex/xecjk/xunicode-addon.sty | 118 +++- 9 files changed, 641 insertions(+), 504 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex index 5e7126280c7..2c35f512225 100644 --- a/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex +++ b/Master/texmf-dist/doc/xelatex/xecjk/example/xeCJK-example-autofake.tex @@ -8,9 +8,9 @@ %% \documentclass{article} \usepackage[AutoFakeBold,AutoFakeSlant]{xeCJK} -\setCJKmainfont[BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc} +\setCJKmainfont[BoldFont=simhei.ttf, SlantedFont=simkai.ttf]{simsun.ttc} \setCJKsansfont[AutoFakeSlant=false, - BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc} + BoldFont=simhei.ttf, SlantedFont=simkai.ttf]{simsun.ttc} \setCJKmonofont[ItalicFont=simkai.ttf]{simsun.ttc} \begin{document} \centering diff --git a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf index d02171834e6..209e0825ac2 100644 Binary files a/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf and b/Master/texmf-dist/doc/xelatex/xecjk/xeCJK.pdf differ diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx index ce3deb0783f..61cc1e1a36b 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.dtx @@ -90,7 +90,7 @@ CJK scripts fonts (TrueType or OpenType). \askforoverwritefalse \preamble -$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: @@ -189,7 +189,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} % -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %<*driver|package> {Typesetting CJK scripts with XeLaTeX} % @@ -209,9 +209,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % {xeCJKfntef} % {xeCJK-listings} % {xunicode-addon} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} %<*driver> -\def\xeCJKversion{3.2.5} +\def\xeCJKversion{3.2.6} \let\xeCJKdate\ExplFileDate \let\xeCJKrevnum\ExplFileVersion \ExplSyntaxOff @@ -335,12 +335,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \fi % -% \CheckSum{5213} +% \CheckSum{5262} % \changes{v3.1.0}{2012/11/13}{放弃对 \cs{outer} 宏的特殊处理。} % \changes{v3.1.1}{2012/12/07}{不再依赖 \pkg{xpatch} 宏包。} % \changes{v3.2.2}{2013/06/01}{修正某些重音不能正确显示的问题。} % \changes{v3.2.3}{2013/06/07}{提供四个 TECkit 映射文件用于句号转换和简繁互换。} % \changes{v3.2.4}{2013/07/02}{遵循 \hologo{LaTeX3} 变量需要预先声明的原则。} +% \changes{v3.2.6}{2013/07/29}{\texttt{case} 类函数的用法与 \hologo{LaTeX3} 同步。} % % % \title{\bfseries\pkg{xeCJK} 宏包} @@ -1402,7 +1403,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ using~your~TeX~package~manager~or~from~CTAN.\\ \str_if_eq:nnT {#1} { expl3 } { Loading~xeCJK~will~abort! } } -\@ifpackagelater { expl3 } { 2012/11/10 } { } +\@ifpackagelater { expl3 } { 2013/07/20 } { } { \msg_critical:nnn { xeCJK } { l3-too-old } { expl3 } } % \end{macrocode} % @@ -1436,6 +1437,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 各种信息函数的缩略形式。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_msg_new:nn { \msg_new:nnn { xeCJK } } +\cs_new_protected_nopar:Npn \@@_msg_new:nnn { \msg_new:nnnn { xeCJK } } \cs_new_protected_nopar:Npn \@@_error:n { \msg_error:nn { xeCJK } } \cs_new_protected_nopar:Npn \@@_error:nx { \msg_error:nnx { xeCJK } } \cs_new_protected_nopar:Npn \@@_warning:n { \msg_warning:nn { xeCJK } } @@ -2908,13 +2910,54 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \hypertarget{cjk-bound}{} % \begin{macrocode} -\xeCJK_inter_class_toks:nnn { CJK } { Boundary } +\xeCJK_inter_class_toks:nnn { CJK } { Boundary } { \xeCJK_CJK_and_Boundary:w } +% \end{macrocode} +% +% \begin{macro}[internal]{\xeCJK_CJK_and_Boundary:w} +% \changes{v3.2.6}{2013/08/05}{更好的处理边界是 \cs{relax} 的情况。} +% 当边界是 \cs{relax} 的时候,它可能是由 |\csname ...\endcsname| 的形式产生的, +% 这样就可能出现问题\footnote{参见 \url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=71563}。}。 +% 原来是都在未定义控制序列前都加上 \cs{exp_not:N},现在是采用分组结束后手工恢复的方式。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_Boundary:w { - \xeCJK_class_group_end: - { \xeCJK_make_node:n { CJK } } - \xeCJK_ignore_spaces:w + \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token + { + \bool_if:NTF \l_@@_peek_ignore_spaces_bool + { \xeCJK_class_group_end: \xeCJK_space_or_xecglue: } + { \xeCJK_class_group_end: \CJKecglue } + } + { + \bool_if:NTF \l_@@_peek_ignore_spaces_bool + { + \bool_if:nTF + { + \token_if_macro_p:N \l_peek_token || + ( \l_@@_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) + } + { + \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } + \xeCJK_space_or_xecglue: + } + { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } } + } + { + \token_if_eq_meaning:NNTF \l_peek_token \scan_stop: + { \@@_CJK_and_Boundary_relax:N } + { \@@_CJK_and_Boundary_aux: } + } + } + } +\cs_new_protected_nopar:Npn \@@_CJK_and_Boundary_aux: + { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK } } } +\cs_new_protected:Npn \@@_CJK_and_Boundary_relax:N #1 + { + \@@_CJK_and_Boundary_aux: + \token_if_eq_meaning:NNTF #1 \scan_stop: + {#1} { \cs_set_eq:NN #1 \scan_stop: #1 } } % \end{macrocode} +% \end{macro} % % \begin{macro}[internal]{\xeCJK_ignore_spaces:w} % \begin{macrocode} @@ -2926,23 +2969,19 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \xeCJK_space_or_xecglue: } { \CJKecglue } } { - \bool_if:NTF \l_@@_peek_ignore_spaces_bool + \bool_if:NT \l_@@_peek_ignore_spaces_bool { - \xeCJK_remove_node: - { \xeCJK_make_node:n { CJK-space } } + \xeCJK_if_last_node:nT { CJK } + { \xeCJK_remove_node: { \xeCJK_make_node:n { CJK-space } } } \bool_if:nT { \token_if_macro_p:N \l_peek_token || - ( \l_@@_reserve_space_bool && - \token_if_letter_p:N \l_peek_token ) + ( \l_@@_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) } { \xeCJK_space_or_xecglue: } } - { \@@_CJK_and_Boundary_aux: } } } -\cs_new_protected_nopar:Npn \@@_CJK_and_Boundary_aux: - { \cs_if_exist:NF \l_peek_token \exp_not:N } % \end{macrocode} % \end{macro} % @@ -3177,7 +3216,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_Boundary_and_FullLeft_glue:N #1 { - \int_case:nnn { \etex_lastnodetype:D } + \int_case:nnTF { \etex_lastnodetype:D } { { \c_one } { @@ -3226,7 +3265,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \use:n } } } - { \use:n } + { { \@@_punct_glue:NN \c_@@_left_tl {#1} } } { \@@_punct_glue:NN \c_@@_left_tl {#1} } } % \end{macrocode} @@ -3428,11 +3467,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \xeCJK_get_punct_bounds:NN \c_@@_right_tl \g_@@_last_punct_tl \@@_punct_rule:NN \c_@@_right_tl \g_@@_last_punct_tl - \tl_case:Non \l_peek_token { \l_@@_no_break_cs_case_tl } { } + \group_align_safe_begin: + \tl_case:NoTF \l_peek_token + { \l_@@_no_break_cs_case_tl } + { \group_align_safe_end: \xeCJK_no_break: } + { \group_align_safe_end: } \@@_punct_glue:NN \c_@@_right_tl \g_@@_last_punct_tl \xeCJK_class_group_end: } -\cs_generate_variant:Nn \tl_case:Nnn { No } +\cs_generate_variant:Nn \tl_case:NnTF { No } % \end{macrocode} % \end{macro} % @@ -3482,7 +3525,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 设置不能在全角右标点之后断行的控制序列。 % \begin{macrocode} \xeCJK_cs_case_keys_define:nNNnn { NoBreakCS } - \l_@@_no_break_cs_case_tl \l_@@_no_break_cs_seq { \xeCJK_no_break: } { } + \l_@@_no_break_cs_case_tl \l_@@_no_break_cs_seq { } { } % \end{macrocode} % \end{macro} % @@ -3543,12 +3586,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \peek_catcode:NTF \c_catcode_letter_token { \xeCJK_check_single:NNw #1 } { + \group_align_safe_begin: \token_if_other:NTF \l_peek_token - { \xeCJK_check_single:NNw #1 } + { \group_align_safe_end: \xeCJK_check_single:NNw #1 } { + \group_align_safe_end: \bool_if:nTF { - \xeCJK_if_blank_x_p:n { \token_get_arg_spec:N \l_peek_token } && + \str_if_eq_x_p:nn { \token_get_arg_spec:N \l_peek_token } { } && \exp_args:No \tl_if_single_token_p:n \l_peek_token && ( \exp_after:wN \token_if_other_p:N \l_peek_token || \exp_after:wN \token_if_letter_p:N \l_peek_token ) @@ -3663,14 +3708,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % l.10 \item % \end{verbatim} % 原因在于 \env{tabenum} 实际上是一个 \TeX 对齐环境(\cs{halign}),\cs{par} 在 -% 其中被重定义为 \cs{cr}。而在下面 \cs{tl_case:Nnn} 的分支里有对 \cs{par} 的 +% 其中被重定义为 \cs{cr}。而在下面 \cs{tl_case:NnF} 的分支里有对 \cs{par} 的 % \cs{ifx} 判断。解决办法是将判断用 \cs{group_align_safe_begin:} 和 % \cs{group_align_safe_end:} 包起来。或者改用原语 \cs{tex_par:D} 作为判断条件。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_check_single_cs:NNn #1#2#3 { \group_align_safe_begin: - \tl_case:Non \l_peek_token + \tl_case:NoF \l_peek_token { \l_@@_check_single_cs_case_tl } { \group_align_safe_end: \use_iii:nnn } { \xeCJK_check_single_env:nnNn } @@ -3681,6 +3726,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_check_single_save:N #1 #2#3 } } \tl_new:N \l_@@_check_single_cs_case_tl +\cs_generate_variant:Nn \tl_case:NnF { No } % \end{macrocode} % \end{macro} % @@ -3689,13 +3735,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_new_protected_nopar:Npn \xeCJK_check_single_env:nnNn #1#2#3#4 { \group_align_safe_begin: - \str_case_x:non {#4} + \str_case_x:noTF {#4} { \l_@@_inline_env_case_tl } - { \group_align_safe_end: \use_i:nn } - {#1} {#2} - \scan_stop: #3 {#4} + { \group_align_safe_end: #2 } + { \group_align_safe_end: #1 } + #3 {#4} } -\cs_generate_variant:Nn \str_case_x:nnn { no } +\cs_generate_variant:Nn \str_case_x:nnTF { no } % \end{macrocode} % \end{macro} % @@ -3762,7 +3808,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \tl_clear:N \l_@@_inline_env_case_tl \seq_map_inline:Nn \l_@@_inline_env_seq - { \tl_put_right:Nn \l_@@_inline_env_case_tl { {##1} { \use_ii:nn } } } + { \tl_put_right:Nn \l_@@_inline_env_case_tl { {##1} { } } } } \tl_new:N \l_@@_inline_env_case_tl % \end{macrocode} @@ -4841,34 +4887,30 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal] -% {\g_@@_features_id_prop, BoldFont, ItalicFont, BoldItalicFont, -% SlantedFont, BoldSlantedFont,BoldFeatures, ItalicFeatures, -% BoldItalicFeatures, SlantedFeatures, BoldSlantedFeatures} +% \begin{macro}[internal]{BoldFont,ItalicFont} % 调用字体的属性声明,同 \pkg{fontspec} 宏包。 % \begin{macrocode} -\prop_new:N \g_@@_features_id_prop -\prop_put:Nnn \g_@@_features_id_prop { bf } { Bold } -\prop_put:Nnn \g_@@_features_id_prop { it } { Italic } -\prop_put:Nnn \g_@@_features_id_prop { bfit } { BoldItalic } -\prop_put:Nnn \g_@@_features_id_prop { sl } { Slanted } -\prop_put:Nnn \g_@@_features_id_prop { bfsl } { BoldSlanted } -\prop_map_inline:Nn \g_@@_features_id_prop +\keys_define:nn { xeCJK / features } { - \keys_define:nn { xeCJK / features } - { - #2Font .tl_set:c = { l_@@_font_name_#1_tl } , - #2Features .clist_set:c = { l_@@_font_feat_#1_clist } - } + BoldFont .tl_set:N = \l_@@_font_name_bf_tl , + ItalicFont .tl_set:N = \l_@@_font_name_it_tl } % \end{macrocode} % \end{macro} % +% \changes{v3.2.6}{2013/07/31}{\texttt{AutoFakeBold} 和 \texttt{AutoFakeSlant} +% 选项直接使用 \pkg{fontspec} 的设置,修正不能调用相应实际字体的问题。} +% % \begin{macro}[internal]{AutoFakeBold, AutoFakeSlant} % \begin{macrocode} \keys_define:nn { xeCJK / features } { AutoFakeBold .choice: , + AutoFakeBold / true .code:n = + { + \bool_set_true:N \l_@@_auto_fake_bold_bool + \fp_set_eq:NN \l_@@_embolden_factor_fp \g_@@_embolden_factor_fp + } , AutoFakeBold / false .code:n = { \bool_set_false:N \l_@@_auto_fake_bold_bool } , AutoFakeBold / unknown .code:n = @@ -4876,8 +4918,13 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \bool_set_true:N \l_@@_auto_fake_bold_bool \fp_set:Nn \l_@@_embolden_factor_fp { \l_keys_value_tl } } , - AutoFakeBold .default:n = { \g_@@_embolden_factor_fp } , + AutoFakeBold .default:n = { true } , AutoFakeSlant .choice: , + AutoFakeSlant / true .code:n = + { + \bool_set_true:N \l_@@_auto_fake_slant_bool + \fp_set_eq:NN \l_@@_slant_factor_fp \g_@@_slant_factor_fp + } , AutoFakeSlant / false .code:n = { \bool_set_false:N \l_@@_auto_fake_slant_bool } , AutoFakeSlant / unknown .code:n = @@ -4885,7 +4932,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \bool_set_true:N \l_@@_auto_fake_slant_bool \fp_set:Nn \l_@@_slant_factor_fp { \l_keys_value_tl } } , - AutoFakeSlant .default:n = { \g_@@_slant_factor_fp } + AutoFakeSlant .default:n = { true } } % \end{macrocode} % \end{macro} @@ -4895,21 +4942,16 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_new_protected_nopar:Npn \@@_set_family_initial: { \int_gincr:N \g_@@_family_int - \prop_clear:N \l_@@_add_font_prop \prop_clear:N \l_@@_sub_key_prop - \prop_map_inline:Nn \g_@@_features_id_prop - { - \tl_clear:c { l_@@_font_name_##1_tl } - \clist_clear:c { l_@@_font_feat_##1_clist } - } + \tl_clear:N \l_@@_font_name_bf_tl + \tl_clear:N \l_@@_font_name_it_tl \clist_clear:N \l_@@_fontspec_options_clist - \bool_set_eq:NN \l_@@_auto_fake_bold_bool \g_@@_auto_fake_bold_bool - \bool_set_eq:NN \l_@@_auto_fake_slant_bool \g_@@_auto_fake_slant_bool + \bool_set_eq:NN \l_@@_auto_fake_bold_bool \g_@@_auto_fake_bold_bool + \bool_set_eq:NN \l_@@_auto_fake_slant_bool \g_@@_auto_fake_slant_bool \fp_set_eq:NN \l_@@_embolden_factor_fp \g_@@_embolden_factor_fp \fp_set_eq:NN \l_@@_slant_factor_fp \g_@@_slant_factor_fp } \int_new:N \g_@@_family_int -\prop_new:N \l_@@_add_font_prop \prop_new:N \l_@@_sub_key_prop \clist_new:N \l_@@_fontspec_options_clist \bool_new:N \l_@@_auto_fake_bold_bool @@ -4934,8 +4976,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \@@_remove_duplicate_keys:N \l_@@_font_options_clist \keys_set_known:nVN { xeCJK / features } \l_@@_font_options_clist \l_@@_fontspec_options_clist - \@@_parse_features: - \@@_pass_features: + \@@_parse_font_shape: \@@_check_family:V \l_@@_family_name_tl \@@_gset_family_cs:x { \l_@@_family_name_tl } \@@_save_family_info: @@ -4985,7 +5026,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_gset_protected_nopar:cpx { \@@_family_csname:n {#1} } { \group_begin: - \exp_not:n { \cs_set_eq:NN \@@_update_family:n \use_none:n } + \exp_not:n { \cs_set_eq:NN \@@_update_family:n \use_none:nn } \exp_not:n { \fontspec_set_family:Nnn \l_@@_fontspec_family_tl } { \exp_not:V \l_@@_fontspec_options_clist } { \exp_not:V \l_@@_font_name_tl } @@ -5001,7 +5042,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_check_family:n #1 { - \prop_get:NnNT \g_@@_family_font_name_prop {#1} \l_@@_tmp_tl + \prop_gpop:NnNT \g_@@_family_font_name_prop {#1} \l_@@_tmp_tl { \prop_gpop:NnNT \g_@@_family_name_prop {#1} \l_@@_tmp_tl { \cs_undefine:c { \@@_family_nfss_csname:n {#1} } } @@ -5014,154 +5055,34 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\@@_add_font:nn,\@@_add_font_if_new:nn} -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_add_font:nn #1#2 - { \prop_put:Nnn \l_@@_add_font_prop { #1 Font } {#2} } -\cs_new_protected_nopar:Npn \@@_add_font_if_new:nn #1#2 - { \prop_put_if_new:Nnn \l_@@_add_font_prop { #1 Font } {#2} } -\cs_generate_variant:Nn \@@_add_font:nn { nx , nV , nv } -\cs_generate_variant:Nn \@@_add_font_if_new:nn { nx , nV , nv } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[internal]{\@@_add_fake_bold:n,\@@_add_fake_slant:n} -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_add_fake_bold:n #1 - { - \clist_put_left:cx { l_@@_font_feat_#1_clist } - { FakeBold = { \fp_use:N \l_@@_embolden_factor_fp } } - } -\cs_new_protected_nopar:Npn \@@_add_fake_slant:n #1 - { - \clist_put_left:cx { l_@@_font_feat_#1_clist } - { FakeSlant = { \fp_use:N \l_@@_slant_factor_fp } } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[internal]{\@@_parse_features:,\@@_parse_features:nn} +% \begin{macro}[internal]{\@@_parse_font_shape:} % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_parse_features: - { \prop_map_function:NN \g_@@_features_id_prop \@@_parse_features:nn } -\cs_new_protected_nopar:Npn \@@_parse_features:nn #1#2 +\cs_new_protected_nopar:Npn \@@_parse_font_shape: { - \@@_if_font_select:nTF {#1} + \tl_if_blank:VTF \l_@@_font_name_bf_tl { - \@@_add_font:nv {#2} { l_@@_font_name_#1_tl } - \@@_if_it_or_sl:nTF {#1} - { - \@@_if_font_select:nF { bf #1 } - { \@@_add_font_if_new:nv {#2} { l_@@_font_name_#1_tl } } - } + \bool_if:NT \l_@@_auto_fake_bold_bool { - \str_if_eq:nnT {#1} { bf } - { - \@@_if_font_select:nF { bfit } - { \@@_add_font:nV { BoldItalic } \l_@@_font_name_bf_tl } - \@@_if_font_select:nF { bfsl } - { \@@_add_font:nV { BoldSlanted } \l_@@_font_name_bf_tl } - } + \clist_put_right:Nx \l_@@_fontspec_options_clist + { AutoFakeBold = { \fp_use:N \l_@@_embolden_factor_fp } } } } - { \@@_set_fake_font:nn {#1} {#2} } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[pTF,internal]{\@@_if_font_select:n,\@@_if_it_or_sl:n} -% \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_font_select:n #1 { p , T , F , TF } - { - \tl_if_blank:vTF { l_@@_font_name_#1_tl } - { \prg_return_false: } { \prg_return_true: } - } -\prg_new_conditional:Npnn \@@_if_it_or_sl:n #1 { p , T , F , TF } - { - \if_predicate:w - \bool_if_p:n { \str_if_eq_p:nn { it } {#1} || \str_if_eq_p:nn { sl } {#1} } - \prg_return_true: \else: \prg_return_false: \fi: - } -\cs_generate_variant:Nn \tl_if_blank:nTF { v } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[internal]{\@@_set_fake_font:nn} -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_set_fake_font:nn #1#2 - { - \str_if_eq:nnTF {#1} { bf } - { \bool_if:NT \l_@@_auto_fake_bold_bool { \@@_add_fake_bold:n {#1} } } { - \bool_if:NTF \l_@@_auto_fake_slant_bool - { - \bool_if:nT - { \@@_if_it_or_sl_p:n {#1} - || ( \str_if_eq_p:nn {#1} { bfit } - && ! ( \@@_if_font_select_p:n { it } ) ) - || ( \str_if_eq_p:nn {#1} { bfsl } - && ! ( \@@_if_font_select_p:n { sl } ) ) - } - { \@@_add_fake_slant:n {#1} } - } - { \@@_if_it_or_sl:nT {#1} { \@@_map_it_sl:nn {#1} {#2} } } - \bool_if:nT - { \l_@@_auto_fake_bold_bool - && ! ( \@@_if_it_or_sl_p:n {#1} ) - && ! ( \@@_if_font_select_p:n { bf } ) - } - { \@@_add_fake_bold:n {#1} } + \clist_put_right:Nx \l_@@_fontspec_options_clist + { BoldFont = { \exp_not:V \l_@@_font_name_bf_tl } } } - \@@_add_font_if_new:nn {#2} { * } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[internal]{\@@_map_it_sl:n} -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_map_it_sl:nn #1#2 - { - \@@_if_map_font_select:nT {#1} + \tl_if_blank:VTF \l_@@_font_name_it_tl { - \@@_add_font:nx {#2} { \@@_get_map_font:n {#1} } - \@@_if_font_select:nF { bf #1 } - { \@@_add_font_if_new:nx { Bold #2 } { \@@_get_map_font:n {#1} } } - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[internal]{\@@_get_map_font:n} -% \begin{macrocode} -\cs_new_nopar:Npn \@@_get_map_font:n #1 - { \exp_not:v { l_@@_font_name_ \xeCJK_reverse:nnn {#1} { it } { sl } _tl } } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[pTF,internal]{\@@_if_map_font_select:n} -% \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_map_font_select:n #1 { p , T , F , TF } - { - \xeCJK_if_blank_x:nTF { \@@_get_map_font:n {#1} } - { \prg_return_false: } { \prg_return_true: } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[internal]{\@@_pass_features:} -% \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_pass_features: - { - \prop_map_inline:Nn \g_@@_features_id_prop - { - \clist_if_empty:cF { l_@@_font_feat_##1_clist } + \bool_if:NT \l_@@_auto_fake_slant_bool { \clist_put_right:Nx \l_@@_fontspec_options_clist - { ##2Features = { \exp_not:v { l_@@_font_feat_##1_clist } } } + { AutoFakeSlant = { \fp_use:N \l_@@_slant_factor_fp } } } } - \prop_map_inline:Nn \l_@@_add_font_prop - { \clist_put_right:Nn \l_@@_fontspec_options_clist { ##1 = {##2} } } + { + \clist_put_right:Nx \l_@@_fontspec_options_clist + { ItalicFont = { \exp_not:V \l_@@_font_name_it_tl } } + } } % \end{macrocode} % \end{macro} @@ -5179,12 +5100,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_save_family_info: { - \group_begin: \prop_gput:NVV \g_@@_family_font_name_prop \l_@@_family_name_tl \l_@@_font_name_tl \prop_gput:NVV \g_@@_family_font_options_prop \l_@@_family_name_tl \l_@@_font_options_clist - \group_end: } % \end{macrocode} % \end{macro} @@ -5750,6 +5669,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal]{\xeCJK_set_mathfont:} +% \changes{v3.2.6}{2013/08/01}{设置粗体时先检查对应字体是否存在。} % 当没有设置 CJK 数学字体时,使用 \cs{CJKfamilydefault} 作为数学字体。 % \begin{macrocode} \cs_new_protected_nopar:Npn \xeCJK_set_mathfont: @@ -5764,10 +5684,14 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \prop_get:NVNT \g_@@_family_name_prop \l_@@_tmp_tl \l_@@_tmp_tl { \tl_const:Nx \c_@@_math_family_tl { \l_@@_tmp_tl } - \DeclareSymbolFont \c_@@_math_tl - \c_@@_encoding_tl \c_@@_math_family_tl \mddefault \shapedefault - \SetSymbolFont \c_@@_math_tl { bold } - \c_@@_encoding_tl \c_@@_math_family_tl \bfdefault \shapedefault + \DeclareSymbolFont { \c_@@_math_tl } { \c_@@_encoding_tl } + { \c_@@_math_family_tl } { \mddefault } { \shapedefault } + \cs_if_free:cF + { \c_@@_encoding_tl/\c_@@_math_family_tl/\bfdefault/\shapedefault } + { + \SetSymbolFont { \c_@@_math_tl } { bold } { \c_@@_encoding_tl } + { \c_@@_math_family_tl } { \bfdefault } { \shapedefault } + } \int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c_@@_math_tl } } \clist_concat:NNN \l_@@_tmp_clist \c_@@_CJK_chars_clist \c_@@_FullLeft_chars_clist @@ -5883,7 +5807,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_set_eq:NN \@@_verb_CJKglue: \CJKglue \cs_set_eq:NN \@@_verb_CJKecglue: \CJKecglue \cs_set_eq:NN \@@_verb_check_for_glue: \xeCJK_check_for_glue: - \cs_set_eq:NN \@@_verb_ignore_spaces:w \xeCJK_ignore_spaces:w + \cs_set_eq:NN \@@_verb_boundary:w \xeCJK_CJK_and_Boundary:w \cs_set_protected_nopar:Npx \xeCJKOffVerbAddon { \@@_reset_char_class:n { FullLeft } @@ -5899,7 +5823,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_set_eq:NN \CJKglue \@@_verb_CJKglue: \cs_set_eq:NN \CJKecglue \@@_verb_CJKecglue: \cs_set_eq:NN \xeCJK_check_for_glue: \@@_verb_check_for_glue: - \cs_set_eq:NN \xeCJK_ignore_spaces:w \@@_verb_ignore_spaces:w + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_verb_boundary:w } } \tex_output:D \exp_after:wN \exp_after:wN \exp_after:wN @@ -5921,8 +5845,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_set_eq:NN \CJKecglue \@@_verb_ecglue: } \cs_set_eq:NN \xeCJK_check_for_glue: \CJKecglue - \cs_set_eq:NN \xeCJK_ignore_spaces:w \CJKecglue + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \@@_verb_CJK_and_Boundary:w } +\cs_new_protected_nopar:Npn \@@_verb_CJK_and_Boundary:w + { \xeCJK_class_group_end: \CJKecglue } \cs_new_protected_nopar:Npn \@@_verb_ccglue: { \xeCJK_no_break: \skip_horizontal:N \l_@@_verb_exspace_skip } \cs_new_protected_nopar:Npn \@@_verb_ecglue: @@ -6218,7 +6144,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % 执行宏包选项,并载入 \pkg{fontspec} 宏包和 \pkg{xunicode-addon}。 % \begin{macrocode} \ProcessKeysOptions { xeCJK / options } -\RequirePackage { fontspec } [ 2011/09/13 ] +\RequirePackage { fontspec } [ 2012/05/01 ] \RequirePackage { xunicode-addon } % \end{macrocode} % @@ -6342,41 +6268,101 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % % \subsection{兼容性修补} % -% \begin{macro}[internal]{\(} +% \begin{macro}[internal]{\fontspec_setup_maths:,\mathrm} +% \changes{v3.2.6}{2013/08/02}{为 \cs{mathrm} 减少一个可能的数学字体族。} +% 如果没有设置 \cs{setboldmathrm},即 \cs{g_fontspec_bfmathrm_tl} 为空,那么 +% \cs{mathrm} 的字体实际与 \texttt{operators} 字体族完全一致。这时候应该通过 +% \cs{DeclareSymbolFontAlphabet} 来定义 \cs{mathrm},避免使用它的时候再声明 +% 一个重复的数学字体族。 +% \begin{macrocode} +\cs_if_free:NF \fontspec_setup_maths: + { + \cs_gset_protected_nopar:Npx \fontspec_setup_maths: + { + \exp_not:o + { + \fontspec_setup_maths: + \tl_if_empty:NT \g_fontspec_bfmathrm_tl + { \DeclareSymbolFontAlphabet \mathrm { operators } } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\(,\),\math,\endmath,\ensuremath,\@@_math_robust:N} % \changes{v3.2.5}{2013/07/25} % {解决汉字后紧跟 \cs{(}\texttt{...}\cs{)} 形式的行内数学公式时,不能加入间距的问题。} +% \changes{v3.2.6}{2013/08/03}{考虑 \pkg{ulem} 对 \cs{MakeRobust} 的不当定义。} +% \changes{v3.2.6}{2013/08/03}{考虑 \cs{math} 和 \cs{ensuremath}。} % \cs{(} 的在 \LaTeXe 中的定义是 % \begin{verbatim} % \def\({\relax\ifmmode\@badmath\else$\fi} % \end{verbatim} % 这个定义最开始的 \cs{relax} 是为了防止 \cs{(} 出现在表格单元格的开始位置时,模式 -% 判断不正确(因为 \TeX 会先看单元格中第一个不可展的非空格记号是否是 \cs{omit} 或 \cs{noalign})。^^A -% 但是它会造成一个边界,使 \pkg{xeCJK} 不能看到 \cs{relax} 后面出现的 |$|,从而不能 -% 加入间距\footnote{\url{http://tex.stackexchange.com/q/124773}}。使用 \hologo{eTeX} -% 的 \cs{protected} 来定义它,可以不需要 \cs{relax},或者将 \cs{relax} 改成 -% \cs{scan_align_safe_stop:},都可以避免这些情况。同时 \pkg{fixltx2e}中还使用了 -% |\MakeRobust\(|,我们需要小心处理。 +% 判断不正确(因为 \TeX 会先看单元格中第一个不可展的非空格记号是否是 \cs{omit} 或 +% \cs{noalign})。但是它会造成一个边界,使 \pkg{xeCJK} 不能看到 \cs{relax} 后面出现的 +% |$|,从而不能加入间距\footnote{\url{http://tex.stackexchange.com/q/124773}}。使用 +% \hologo{eTeX} 的 \cs{protected} 来定义它,可以不需要 \cs{relax},或者将 \cs{relax} +% 改成 \cs{scan_align_safe_stop:},都可以避免这些情况。同时 \pkg{fixltx2e} 中还使用了 +% |\MakeRobust\(|,我们需要小心处理。另外 \pkg{ulem} 也定义了一个 \cs{MakeRobust}, +% 如果它被放在 \pkg{fixltx2e} 之前载入,那么 \pkg{fixltx2e} 的定义就会失效(因为 +% \pkg{fixltx2e} 使用 \cs{providecommand*} 来定义 \cs{MakeRobust})。但是 \pkg{ulem} +% 的定义并不完全正确,没有考虑 \TeX 不会略去控制符号后面的空格的情况。 % \begin{macrocode} \cs_new_protected_nopar:Npn \@@_math_robust:N #1 - { \exp_args:NNc \@@_math_robust:NN #1 { \cs_to_str:N #1 ~ } } + { \exp_args:NNc \@@_math_robust_aux:NN #1 { \cs_to_str:N #1 ~ } } +\cs_new_protected_nopar:Npn \@@_math_robust_aux:NN #1#2 + { + \exp_args:Nx \str_case:nnTF { \token_get_replacement_spec:N #1 } + { + { \x@protect #1 \protect #2 } { } + { \protect #2 } { } + } + { \@@_math_robust:NN #1#2 } + { \@@_math_robust:NN #1#1 } + } \cs_new_protected_nopar:Npn \@@_math_robust:NN #1#2 { - \bool_if:nT + \str_if_eq_x:nnTF { \token_get_arg_spec:N #2 } { } { - \str_if_eq_x_p:nn - { \token_get_replacement_spec:N #1 } - { \exp_not:n { \x@protect #1 \protect #2 } } && - \exp_args:Nf \tl_if_empty_p:n { \token_get_arg_spec:N #2 } && - \exp_args:No \tl_if_head_eq_meaning_p:nN {#2} \scan_stop: + \exp_args:No \tl_if_head_eq_meaning:nNTF {#2} \scan_stop: + { + \cs_gset_protected_nopar:Npx #1 + { \scan_align_safe_stop: \tl_tail:N #2 } + } + { + \cs_if_eq:NNTF #1 \ensuremath + { + \cs_gset_protected_nopar:Npx #1 + { \scan_align_safe_stop: \exp_not:o {#2} } + } + { + \@@_warning:nxx { robust-failure } + { \token_to_str:N #1 } { \token_to_meaning:N #2 } + } + } + } + { + \@@_warning:nxx { robust-failure } + { \token_to_str:N #1 } { \token_to_meaning:N #2 } } - { \cs_gset_protected_nopar:Npx #1 { \scan_align_safe_stop: \tl_tail:N #2 } } + } +\@@_msg_new:nnn { robust-failure } + { xeCJK~can~not~make~`#1'~robust. } + { + The~current~meaning~of~`#1'~is:\\ + \iow_indent:n {#2} } \@@_math_robust:N \( \@@_math_robust:N \) +\@@_math_robust:N \math +\@@_math_robust:N \endmath +\@@_math_robust:N \ensuremath % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\[} +% \begin{macro}[internal]{\[,\]} % \changes{v3.2.5}{2013/07/25}{解决 \pkg{fixltx2e} 和 \pkg{amsthm} 的冲突。} % 当 \pkg{amsmath} 没有在 \pkg{amsthm} 之前被调用时,\pkg{amsthm} 会展开 \cs{[}, % 并用 |$| 作为参数定界记号,相关代码为 @@ -6468,19 +6454,15 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \RenewDocumentCommand \fontfamily { m } { \tl_set:Nx \f@family {#1} - \@@_update_family:n + \@@_update_family:nn {#1} { - \str_case:nnn {#1} - { - { \rmdefault } { \xeCJK_switch_family:n { \CJKrmdefault } } - { \sfdefault } { \xeCJK_switch_family:n { \CJKsfdefault } } - { \ttdefault } { \xeCJK_switch_family:n { \CJKttdefault } } - { \familydefault } { \xeCJK_switch_family:n { \CJKfamilydefault } } - } - { } + { \rmdefault } { \xeCJK_switch_family:n { \CJKrmdefault } } + { \sfdefault } { \xeCJK_switch_family:n { \CJKsfdefault } } + { \ttdefault } { \xeCJK_switch_family:n { \CJKttdefault } } + { \familydefault } { \xeCJK_switch_family:n { \CJKfamilydefault } } } } -\cs_new_eq:NN \@@_update_family:n \use:n +\cs_new_eq:NN \@@_update_family:nn \str_case:nn % \end{macrocode} % \end{macro} % @@ -6610,22 +6592,26 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\textellipsis} % 单独处理宽度有分歧的几个标点:包括省略号、破折号、间隔号、引号等中西文混用的 -% 符号, 保证其命令形式输出的是西文字体。并对一些编码的符号宏包做特殊处理。在 -% 使用 \texttt{T1} 编码的时候,|\r{u}| 的实际定义是 |\char183| 与常被用作中文 -% 间隔号的 \texttt{U+00B7} 冲突。 +% 符号, 保证其命令形式输出的是西文字体。 +% \begin{macrocode} +\tl_map_inline:nn + { + \textellipsis \textemdash \textperiodcentered \textcentereddot + \textquoteleft \textquoteright \textquotedblleft \textquotedblright + } + { + \AtBeginUTFCommand [#1] { \@@_group_begin: \makexeCJKinactive } + \AtEndUTFCommand [#1] { \@@_group_end: } + } +% \end{macrocode} +% \end{macro} +% +% 常被用作中文间隔号的 \texttt{U+00B7} 与 T1 等旧字体编码下定义的符号命令冲突。 % \begin{macrocode} \@@_after_preamble:n { - \tl_map_inline:nn - { - \textellipsis \textemdash \textperiodcentered \textcentereddot - \textquoteleft \textquoteright \textquotedblleft \textquotedblright - } - { - \cs_gset_protected_nopar:Npx #1 - { \@@_group_begin: \makexeCJKinactive \exp_not:o {#1} \@@_group_end: } - } \tl_put_left:Nn \tipaencoding { \makexeCJKinactive } \cs_new_eq:NN \@@_aux_r:n \r \cs_set_nopar:Npn \r #1 @@ -6978,6 +6964,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \xeCJK_if_ulem_patch:TF { + \xeCJK_class_group_end: \UL@stop \@@_ulem_hskip:n { \c_zero_skip } \UL@start { \xeCJK_make_node:n { CJK } } } @@ -7982,7 +7969,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_if_csname:nTF {#3} { \@@_declare_character:Nnn #3 } - { \exp_args:Nc \@@_declare_character:Nnn { \tl_to_str:n {#3} } } + { \@@_declare_character:cnn { \tl_to_str:n {#3} } } {#1} {#2} } % \end{macrocode} @@ -8004,6 +7991,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ } #1 { \token_to_str:N #1 } {#2} } +\cs_generate_variant:Nn \@@_declare_character:Nnn { c } % \end{macrocode} % \end{macro} % @@ -8044,10 +8032,10 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \DeclareTextCommand #2 {#4} { \@@_text_character:nN {#3} {#1} } } \cs_new_protected:Npn \@@_text_character:nN #1#2 { - \tl_use:N \l_@@_begin_hook_tl + \@@_begin_hook:nn {#1} {#2} \@@_glyph_if_exist:nTF { `#2 } {#2} { \cs_if_exist_use:cF { ? #1 } {#2} } - \tl_use:N \l_@@_end_hook_tl + \@@_end_hook:nn {#1} {#2} } \cs_generate_variant:Nn \@@_declare_character:NNnn { NNx } % \end{macrocode} @@ -8074,7 +8062,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_if_csname:nTF {#3} { \@@_declare_composite:Nnnn #3 } - { \exp_args:Nc \@@_declare_composite:Nnnn { \tl_to_str:n {#3} } } + { \@@_declare_composite:cnnn { \tl_to_str:n {#3} } } {#1} {#4} {#2} } % \end{macrocode} @@ -8086,7 +8074,6 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \DeclareUTFcomposite[\UTFencname]{x02E8\char"02E5}{\tonebar}{25} % \DeclareUTFcomposite[\UTFencname]{x02E5\char"02E8}{\tonebar}{52} % \end{verbatim} -% 但是这个定义原本就是无效的,|\tonebar{25}| 和 |\tonebar{2}| 的定义一样。 % 对复合符号命令的定义用的是 \cs{chardef},这有利于下面字符是否存在的判断。 % \begin{macrocode} \cs_new_protected:Npn \@@_declare_composite:Nnnn #1#2#3#4 @@ -8100,6 +8087,44 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \cs_new_protected:Npn \@@_chardef:Nn #1#2 { \tex_chardef:D #1 = \etex_numexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \@@_chardef:Nn { c } +\cs_generate_variant:Nn \@@_declare_composite:Nnnn { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\tonebar} +% 使得 |\tonebar{25}| 和 |\tonebar{52}| 生效。 +% \begin{macrocode} +\AtEndOfPackage + { + \DeclareUTFCompositeCommand \tonebar { 25 } { \tonebar { 2 } \tonebar { 5 } } + \DeclareUTFCompositeCommand \tonebar { 52 } { \tonebar { 5 } \tonebar { 2 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\DeclareUTFCompositeCommand} +% 设置编码 |#1| 下的符号命令 |#2| 与它的参数 |#3| 的复合对应结果是 |#4|。不能直接用 +% \cs{Declare\-Text\-Composite\-Command} 来定义,它与我们的机制冲突。 +% \begin{macrocode} +\NewDocumentCommand \DeclareUTFCompositeCommand { O { \UTFencname } m m m } + { + \@@_if_csname:nTF {#2} + { \@@_declare_composite_command:Nnnn #2 } + { \@@_declare_composite_command:cnnn { \tl_to_str:n {#2} } } + {#1} {#3} {#4} + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\@@_declare_composite_command:Nnnn} +% \begin{macrocode} +\cs_new_protected:Npn \@@_declare_composite_command:Nnnn #1#2#3#4 + { + \cs_set_protected:cpn + { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } + {#4} + } +\cs_generate_variant:Nn \@@_declare_composite_command:Nnnn { c } % \end{macrocode} % \end{macro} % @@ -8111,7 +8136,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_if_csname:nTF {#2} { \@@_declare_accent:Nnnn #2 } - { \exp_args:Nc \@@_declare_accent:Nnnn { \tl_to_str:n {#2} } } + { \@@_declare_accent:cnnn { \tl_to_str:n {#2} } } {#1} {#3} {#4} } % \end{macrocode} @@ -8125,7 +8150,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ { \@@_if_csname:nTF {#2} { \@@_declare_accent:Nnnn #2 } - { \exp_args:Nc \@@_declare_accent:Nnnn { \tl_to_str:n {#2} } } + { \@@_declare_accent:cnnn { \tl_to_str:n {#2} } } {#1} {#4} {#3} } % \end{macrocode} @@ -8151,6 +8176,7 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ \DeclareTextCommand #3 {#6} { \@@_text_composite:nnNNn {#4} {#5} {#1} {#2} } } +\cs_generate_variant:Nn \@@_declare_accent:Nnnn { c } \cs_generate_variant:Nn \@@_declare_accent:NNNnnn { NNNxx } % \end{macrocode} % \end{macro} @@ -8161,21 +8187,25 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \cs_new_protected:Npn \@@_text_composite:nnNNn #1#2#3#4#5 { - \tl_use:N \l_@@_begin_hook_tl + \@@_begin_hook:nn {#2} {#5} \cs_if_exist:cTF { #1#2 - \tl_to_str:n {#5} } { - \token_if_chardef:cTF { #1#2 - \tl_to_str:n {#5} } - { - \@@_glyph_if_exist:nTF { \use:c { #1#2 - \tl_to_str:n {#5} } } - { \use:c { #1#2 - \tl_to_str:n {#5} } } - { \@@_add_accent:nnNN {#5} {#2} #3#4 } - } - { \use:c { #1#2 - \tl_to_str:n {#5} } } + \@@_text_composite_aux:cnNNn + { #1#2 - \tl_to_str:n {#5} } {#2} {#3} {#4} {#5} } - { \@@_add_accent:nnNN {#5} {#2} #3#4 } - \tl_use:N \l_@@_end_hook_tl + { \@@_add_accent:nnNN {#5} {#2} {#3} {#4} } + \@@_end_hook:nn {#2} {#5} } -\cs_generate_variant:Nn \token_if_chardef:NTF { c } +\cs_new_protected:Npn \@@_text_composite_aux:NnNNn #1#2#3#4#5 + { + \token_if_chardef:NTF #1 + { + \@@_glyph_if_exist:nTF {#1} + {#1} { \@@_add_accent:nnNN {#5} {#2} {#3} {#4} } + } + {#1} + } +\cs_generate_variant:Nn \@@_text_composite_aux:NnNNn { c } % \end{macrocode} % \end{macro} % @@ -8216,25 +8246,73 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \end{macro} % % \begin{macro}[internal]{\AtBeginUTFCommand,\AtEndUTFCommand} -% 在符号命令前后使用的钩子。 +% 设置在符号命令前后使用的钩子,可选参数用于指定单个符号命名。可以用 |#1| +% 引用带参数的组合符号命令的参数或者符号命令对应的符号。 +% \changes{v3.2.6}{2013/08/15}{可以指定特定符号命令使用的钩子。} % \begin{macrocode} -\NewDocumentCommand \AtBeginUTFCommand { s +m } +\NewDocumentCommand \AtBeginUTFCommand { s O { } +m } { - \IfBooleanTF {#1} - { \tl_set:Nn \l_@@_begin_hook_tl {#2} } - { \tl_put_right:Nn \l_@@_begin_hook_tl {#2} } + \tl_if_blank:nTF {#2} + { + \IfBooleanTF {#1} + { \tl_set:Nn \l_@@_begin_hook_tl {#3} } + { \tl_put_right:Nn \l_@@_begin_hook_tl {#3} } + } + { \@@_set_cmd_hook:nnn { begin } {#2} {#3} } } -\NewDocumentCommand \AtEndUTFCommand { s +m } +\NewDocumentCommand \AtEndUTFCommand { s O { } +m } { - \IfBooleanTF {#1} - { \tl_set:Nn \l_@@_end_hook_tl {#2} } - { \tl_put_right:Nn \l_@@_end_hook_tl {#2} } + \tl_if_blank:nTF {#2} + { + \IfBooleanTF {#1} + { \tl_set:Nn \l_@@_end_hook_tl {#3} } + { \tl_put_right:Nn \l_@@_end_hook_tl {#3} } + } + { \@@_set_cmd_hook:nnn { end } {#2} {#3} } } \tl_new:N \l_@@_begin_hook_tl \tl_new:N \l_@@_end_hook_tl % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@@_set_cmd_hook:nnn} +% \begin{macrocode} +\cs_new_protected:Npn \@@_set_cmd_hook:nnn #1#2#3 + { + \cs_set_protected:cpn + { + \tl_if_single:nTF {#2} + { \use:c { @@_#1_csname:n } { \token_to_str:N #2 } } + { \@@_set_cmd_hook_aux:Nnwn #2 \q_stop {#1} } + } ##1 + {#3} + } +\cs_new:Npn \@@_set_cmd_hook_aux:Nnwn #1#2 \q_stop #3 + { \use:c { @@_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } } +\cs_new_nopar:Npn \@@_begin_csname:n #1 { @@_begin_#1_hook:n } +\cs_new_nopar:Npn \@@_end_csname:n #1 { @@_end_#1_hook:n } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\@@_begin_hook:nn,\@@_end_hook:nn} +% \begin{macrocode} +\cs_new_protected:Npn \@@_begin_hook:nn #1#2 + { + \tl_use:N \l_@@_begin_hook_tl + \cs_if_exist_use:cF { \@@_begin_csname:n { #1 - \tl_to_str:n {#2} } } + { \cs_if_exist_use:cF { \@@_begin_csname:n {#1} } { \use_none:n } } + {#2} + } +\cs_new_protected:Npn \@@_end_hook:nn #1#2 + { + \cs_if_exist_use:cF { \@@_end_csname:n { #1 - \tl_to_str:n {#2} } } + { \cs_if_exist_use:cF { \@@_end_csname:n {#1} } { \use_none:n } } + {#2} + \tl_use:N \l_@@_end_hook_tl + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} @@ -8277,9 +8355,9 @@ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ % \begin{macrocode} \documentclass{article} \usepackage[AutoFakeBold,AutoFakeSlant]{xeCJK} -\setCJKmainfont[BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc} +\setCJKmainfont[BoldFont=simhei.ttf, SlantedFont=simkai.ttf]{simsun.ttc} \setCJKsansfont[AutoFakeSlant=false, - BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{simsun.ttc} + BoldFont=simhei.ttf, SlantedFont=simkai.ttf]{simsun.ttc} \setCJKmonofont[ItalicFont=simkai.ttf]{simsun.ttc} \begin{document} \centering diff --git a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins index 4285ca1f382..70a8176ed79 100644 --- a/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins +++ b/Master/texmf-dist/source/xelatex/xecjk/xeCJK.ins @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `install') %% -%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -37,7 +37,7 @@ \askforoverwritefalse \preamble -$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ ----------------------------------------------------------------- Author: diff --git a/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg b/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg index 2e32945e9bf..e8e4375851b 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg +++ b/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg @@ -6,11 +6,11 @@ %% %% xeCJK.dtx (with options: `config') %% -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ {Configuration file for xeCJK package} \ProvidesExplFile {\ExplFileName.cfg} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} %% %% diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty index a3953c92c43..e07d41cfa1d 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `listings') %% -%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -33,11 +33,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ {xeCJK patch file for listings} \ProvidesExplPackage {xeCJK-listings} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { xeCJK } } \ProcessOptions \scan_stop: \RequirePackage { xeCJK } diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index 629aaf9d8dd..c52709f906a 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `package') %% -%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -33,11 +33,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ {Typesetting CJK scripts with XeLaTeX} \ProvidesExplPackage {\ExplFileName} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -81,7 +81,7 @@ using~your~TeX~package~manager~or~from~CTAN.\\ \str_if_eq:nnT {#1} { expl3 } { Loading~xeCJK~will~abort! } } -\@ifpackagelater { expl3 } { 2012/11/10 } { } +\@ifpackagelater { expl3 } { 2013/07/20 } { } { \msg_critical:nnn { xeCJK } { l3-too-old } { expl3 } } \RequirePackage { xtemplate } \@ifpackagelater { xtemplate } { 2012/11/10 } { } @@ -95,6 +95,7 @@ \skip_new:N \l__xeCJK_tmp_skip \clist_new:N \l__xeCJK_tmp_clist \cs_new_protected_nopar:Npn \__xeCJK_msg_new:nn { \msg_new:nnn { xeCJK } } +\cs_new_protected_nopar:Npn \__xeCJK_msg_new:nnn { \msg_new:nnnn { xeCJK } } \cs_new_protected_nopar:Npn \__xeCJK_error:n { \msg_error:nn { xeCJK } } \cs_new_protected_nopar:Npn \__xeCJK_error:nx { \msg_error:nnx { xeCJK } } \cs_new_protected_nopar:Npn \__xeCJK_warning:n { \msg_warning:nn { xeCJK } } @@ -838,11 +839,43 @@ space .meta:n = { CJKspace = true } , nospace .meta:n = { CJKspace = false } } -\xeCJK_inter_class_toks:nnn { CJK } { Boundary } +\xeCJK_inter_class_toks:nnn { CJK } { Boundary } { \xeCJK_CJK_and_Boundary:w } +\cs_new_protected_nopar:Npn \xeCJK_CJK_and_Boundary:w { - \xeCJK_class_group_end: - { \xeCJK_make_node:n { CJK } } - \xeCJK_ignore_spaces:w + \xeCJK_peek_catcode_ignore_spaces:NTF \c_math_toggle_token + { + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { \xeCJK_class_group_end: \xeCJK_space_or_xecglue: } + { \xeCJK_class_group_end: \CJKecglue } + } + { + \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + { + \bool_if:nTF + { + \token_if_macro_p:N \l_peek_token || + ( \l__xeCJK_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) + } + { + \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } + \xeCJK_space_or_xecglue: + } + { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK-space } } } + } + { + \token_if_eq_meaning:NNTF \l_peek_token \scan_stop: + { \__xeCJK_CJK_and_Boundary_relax:N } + { \__xeCJK_CJK_and_Boundary_aux: } + } + } + } +\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_Boundary_aux: + { \xeCJK_class_group_end: { \xeCJK_make_node:n { CJK } } } +\cs_new_protected:Npn \__xeCJK_CJK_and_Boundary_relax:N #1 + { + \__xeCJK_CJK_and_Boundary_aux: + \token_if_eq_meaning:NNTF #1 \scan_stop: + {#1} { \cs_set_eq:NN #1 \scan_stop: #1 } } \cs_new_protected_nopar:Npn \xeCJK_ignore_spaces:w { @@ -852,23 +885,19 @@ { \xeCJK_space_or_xecglue: } { \CJKecglue } } { - \bool_if:NTF \l__xeCJK_peek_ignore_spaces_bool + \bool_if:NT \l__xeCJK_peek_ignore_spaces_bool { - \xeCJK_remove_node: - { \xeCJK_make_node:n { CJK-space } } + \xeCJK_if_last_node:nT { CJK } + { \xeCJK_remove_node: { \xeCJK_make_node:n { CJK-space } } } \bool_if:nT { \token_if_macro_p:N \l_peek_token || - ( \l__xeCJK_reserve_space_bool && - \token_if_letter_p:N \l_peek_token ) + ( \l__xeCJK_reserve_space_bool && \token_if_letter_p:N \l_peek_token ) } { \xeCJK_space_or_xecglue: } } - { \__xeCJK_CJK_and_Boundary_aux: } } } -\cs_new_protected_nopar:Npn \__xeCJK_CJK_and_Boundary_aux: - { \cs_if_exist:NF \l_peek_token \exp_not:N } \xeCJK_inter_class_toks:nnn { CJK } { CJK } { \xeCJK_CJK_and_CJK:N } \cs_new_protected_nopar:Npn \xeCJK_CJK_and_CJK:N #1 { \CJKglue \CJKsymbol {#1} } \xeCJK_inter_class_toks:nnn { FullLeft } { CJK } @@ -988,7 +1017,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_Boundary_and_FullLeft_glue:N #1 { - \int_case:nnn { \etex_lastnodetype:D } + \int_case:nnTF { \etex_lastnodetype:D } { { \c_one } { @@ -1037,7 +1066,7 @@ { \use:n } } } - { \use:n } + { { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } } { \__xeCJK_punct_glue:NN \c__xeCJK_left_tl {#1} } } \cs_new_protected_nopar:Npn \xeCJK_Default_and_FullRight:nN #1#2 @@ -1166,11 +1195,15 @@ { \xeCJK_get_punct_bounds:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl \__xeCJK_punct_rule:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl - \tl_case:Non \l_peek_token { \l__xeCJK_no_break_cs_case_tl } { } + \group_align_safe_begin: + \tl_case:NoTF \l_peek_token + { \l__xeCJK_no_break_cs_case_tl } + { \group_align_safe_end: \xeCJK_no_break: } + { \group_align_safe_end: } \__xeCJK_punct_glue:NN \c__xeCJK_right_tl \g__xeCJK_last_punct_tl \xeCJK_class_group_end: } -\cs_generate_variant:Nn \tl_case:Nnn { No } +\cs_generate_variant:Nn \tl_case:NnTF { No } \cs_new_protected_nopar:Npn \xeCJK_check_FullRight_symbol:Nw #1 { \xeCJK_peek_after_ignore_spaces:nw { \__xeCJK_save_FullRight_symbol:N {#1} } } \cs_new_protected:Npn \xeCJK_cs_case_keys_define:nNNnn #1#2#3#4#5 @@ -1204,7 +1237,7 @@ #4 } \xeCJK_cs_case_keys_define:nNNnn { NoBreakCS } - \l__xeCJK_no_break_cs_case_tl \l__xeCJK_no_break_cs_seq { \xeCJK_no_break: } { } + \l__xeCJK_no_break_cs_case_tl \l__xeCJK_no_break_cs_seq { } { } \NewDocumentCommand \xeCJKnobreak { } { \bool_set_true:N \l__xeCJK_tmp_bool @@ -1245,12 +1278,14 @@ \peek_catcode:NTF \c_catcode_letter_token { \xeCJK_check_single:NNw #1 } { + \group_align_safe_begin: \token_if_other:NTF \l_peek_token - { \xeCJK_check_single:NNw #1 } + { \group_align_safe_end: \xeCJK_check_single:NNw #1 } { + \group_align_safe_end: \bool_if:nTF { - \xeCJK_if_blank_x_p:n { \token_get_arg_spec:N \l_peek_token } && + \str_if_eq_x_p:nn { \token_get_arg_spec:N \l_peek_token } { } && \exp_args:No \tl_if_single_token_p:n \l_peek_token && ( \exp_after:wN \token_if_other_p:N \l_peek_token || \exp_after:wN \token_if_letter_p:N \l_peek_token ) @@ -1328,7 +1363,7 @@ \cs_new_protected_nopar:Npn \xeCJK_check_single_cs:NNn #1#2#3 { \group_align_safe_begin: - \tl_case:Non \l_peek_token + \tl_case:NoF \l_peek_token { \l__xeCJK_check_single_cs_case_tl } { \group_align_safe_end: \use_iii:nnn } { \xeCJK_check_single_env:nnNn } @@ -1339,16 +1374,17 @@ { \__xeCJK_check_single_save:N #1 #2#3 } } \tl_new:N \l__xeCJK_check_single_cs_case_tl +\cs_generate_variant:Nn \tl_case:NnF { No } \cs_new_protected_nopar:Npn \xeCJK_check_single_env:nnNn #1#2#3#4 { \group_align_safe_begin: - \str_case_x:non {#4} + \str_case_x:noTF {#4} { \l__xeCJK_inline_env_case_tl } - { \group_align_safe_end: \use_i:nn } - {#1} {#2} - \scan_stop: #3 {#4} + { \group_align_safe_end: #2 } + { \group_align_safe_end: #1 } + #3 {#4} } -\cs_generate_variant:Nn \str_case_x:nnn { no } +\cs_generate_variant:Nn \str_case_x:nnTF { no } \xeCJK_cs_case_keys_define:nNNnn { NewLineCS } \l__xeCJK_new_line_cs_case_tl \l__xeCJK_new_line_cs_seq { \group_align_safe_end: \use_ii:nnn } @@ -1391,7 +1427,7 @@ { \tl_clear:N \l__xeCJK_inline_env_case_tl \seq_map_inline:Nn \l__xeCJK_inline_env_seq - { \tl_put_right:Nn \l__xeCJK_inline_env_case_tl { {##1} { \use_ii:nn } } } + { \tl_put_right:Nn \l__xeCJK_inline_env_case_tl { {##1} { } } } } \tl_new:N \l__xeCJK_inline_env_case_tl \keys_define:nn { xeCJK / options } @@ -2201,23 +2237,19 @@ \cs_generate_variant:Nn \__xeCJK_get_sub_features:nn { V } \cs_generate_variant:Nn \tl_replace_all:Nnn { NnV } \xeCJK_new_sub_key:n { FallBack } -\prop_new:N \g__xeCJK_features_id_prop -\prop_put:Nnn \g__xeCJK_features_id_prop { bf } { Bold } -\prop_put:Nnn \g__xeCJK_features_id_prop { it } { Italic } -\prop_put:Nnn \g__xeCJK_features_id_prop { bfit } { BoldItalic } -\prop_put:Nnn \g__xeCJK_features_id_prop { sl } { Slanted } -\prop_put:Nnn \g__xeCJK_features_id_prop { bfsl } { BoldSlanted } -\prop_map_inline:Nn \g__xeCJK_features_id_prop +\keys_define:nn { xeCJK / features } { - \keys_define:nn { xeCJK / features } - { - #2Font .tl_set:c = { l__xeCJK_font_name_#1_tl } , - #2Features .clist_set:c = { l__xeCJK_font_feat_#1_clist } - } + BoldFont .tl_set:N = \l__xeCJK_font_name_bf_tl , + ItalicFont .tl_set:N = \l__xeCJK_font_name_it_tl } \keys_define:nn { xeCJK / features } { AutoFakeBold .choice: , + AutoFakeBold / true .code:n = + { + \bool_set_true:N \l__xeCJK_auto_fake_bold_bool + \fp_set_eq:NN \l__xeCJK_embolden_factor_fp \g__xeCJK_embolden_factor_fp + } , AutoFakeBold / false .code:n = { \bool_set_false:N \l__xeCJK_auto_fake_bold_bool } , AutoFakeBold / unknown .code:n = @@ -2225,8 +2257,13 @@ \bool_set_true:N \l__xeCJK_auto_fake_bold_bool \fp_set:Nn \l__xeCJK_embolden_factor_fp { \l_keys_value_tl } } , - AutoFakeBold .default:n = { \g__xeCJK_embolden_factor_fp } , + AutoFakeBold .default:n = { true } , AutoFakeSlant .choice: , + AutoFakeSlant / true .code:n = + { + \bool_set_true:N \l__xeCJK_auto_fake_slant_bool + \fp_set_eq:NN \l__xeCJK_slant_factor_fp \g__xeCJK_slant_factor_fp + } , AutoFakeSlant / false .code:n = { \bool_set_false:N \l__xeCJK_auto_fake_slant_bool } , AutoFakeSlant / unknown .code:n = @@ -2234,26 +2271,21 @@ \bool_set_true:N \l__xeCJK_auto_fake_slant_bool \fp_set:Nn \l__xeCJK_slant_factor_fp { \l_keys_value_tl } } , - AutoFakeSlant .default:n = { \g__xeCJK_slant_factor_fp } + AutoFakeSlant .default:n = { true } } \cs_new_protected_nopar:Npn \__xeCJK_set_family_initial: { \int_gincr:N \g__xeCJK_family_int - \prop_clear:N \l__xeCJK_add_font_prop \prop_clear:N \l__xeCJK_sub_key_prop - \prop_map_inline:Nn \g__xeCJK_features_id_prop - { - \tl_clear:c { l__xeCJK_font_name_##1_tl } - \clist_clear:c { l__xeCJK_font_feat_##1_clist } - } + \tl_clear:N \l__xeCJK_font_name_bf_tl + \tl_clear:N \l__xeCJK_font_name_it_tl \clist_clear:N \l__xeCJK_fontspec_options_clist - \bool_set_eq:NN \l__xeCJK_auto_fake_bold_bool \g__xeCJK_auto_fake_bold_bool - \bool_set_eq:NN \l__xeCJK_auto_fake_slant_bool \g__xeCJK_auto_fake_slant_bool + \bool_set_eq:NN \l__xeCJK_auto_fake_bold_bool \g__xeCJK_auto_fake_bold_bool + \bool_set_eq:NN \l__xeCJK_auto_fake_slant_bool \g__xeCJK_auto_fake_slant_bool \fp_set_eq:NN \l__xeCJK_embolden_factor_fp \g__xeCJK_embolden_factor_fp \fp_set_eq:NN \l__xeCJK_slant_factor_fp \g__xeCJK_slant_factor_fp } \int_new:N \g__xeCJK_family_int -\prop_new:N \l__xeCJK_add_font_prop \prop_new:N \l__xeCJK_sub_key_prop \clist_new:N \l__xeCJK_fontspec_options_clist \bool_new:N \l__xeCJK_auto_fake_bold_bool @@ -2272,8 +2304,7 @@ \__xeCJK_remove_duplicate_keys:N \l__xeCJK_font_options_clist \keys_set_known:nVN { xeCJK / features } \l__xeCJK_font_options_clist \l__xeCJK_fontspec_options_clist - \__xeCJK_parse_features: - \__xeCJK_pass_features: + \__xeCJK_parse_font_shape: \__xeCJK_check_family:V \l__xeCJK_family_name_tl \__xeCJK_gset_family_cs:x { \l__xeCJK_family_name_tl } \__xeCJK_save_family_info: @@ -2313,7 +2344,7 @@ \cs_gset_protected_nopar:cpx { \__xeCJK_family_csname:n {#1} } { \group_begin: - \exp_not:n { \cs_set_eq:NN \__xeCJK_update_family:n \use_none:n } + \exp_not:n { \cs_set_eq:NN \__xeCJK_update_family:n \use_none:nn } \exp_not:n { \fontspec_set_family:Nnn \l__xeCJK_fontspec_family_tl } { \exp_not:V \l__xeCJK_fontspec_options_clist } { \exp_not:V \l__xeCJK_font_name_tl } @@ -2324,7 +2355,7 @@ \tl_new:N \l__xeCJK_fontspec_family_tl \cs_new_protected_nopar:Npn \__xeCJK_check_family:n #1 { - \prop_get:NnNT \g__xeCJK_family_font_name_prop {#1} \l__xeCJK_tmp_tl + \prop_gpop:NnNT \g__xeCJK_family_font_name_prop {#1} \l__xeCJK_tmp_tl { \prop_gpop:NnNT \g__xeCJK_family_name_prop {#1} \l__xeCJK_tmp_tl { \cs_undefine:c { \__xeCJK_family_nfss_csname:n {#1} } } @@ -2334,124 +2365,42 @@ \cs_generate_variant:Nn \__xeCJK_check_family:n { V } \__xeCJK_msg_new:nn { CJKfamily-redef } { Redefining~CJKfamily~`\__xeCJK_msg_family_map:n {#1}'~(#2). } -\cs_new_protected_nopar:Npn \__xeCJK_add_font:nn #1#2 - { \prop_put:Nnn \l__xeCJK_add_font_prop { #1 Font } {#2} } -\cs_new_protected_nopar:Npn \__xeCJK_add_font_if_new:nn #1#2 - { \prop_put_if_new:Nnn \l__xeCJK_add_font_prop { #1 Font } {#2} } -\cs_generate_variant:Nn \__xeCJK_add_font:nn { nx , nV , nv } -\cs_generate_variant:Nn \__xeCJK_add_font_if_new:nn { nx , nV , nv } -\cs_new_protected_nopar:Npn \__xeCJK_add_fake_bold:n #1 - { - \clist_put_left:cx { l__xeCJK_font_feat_#1_clist } - { FakeBold = { \fp_use:N \l__xeCJK_embolden_factor_fp } } - } -\cs_new_protected_nopar:Npn \__xeCJK_add_fake_slant:n #1 - { - \clist_put_left:cx { l__xeCJK_font_feat_#1_clist } - { FakeSlant = { \fp_use:N \l__xeCJK_slant_factor_fp } } - } -\cs_new_protected_nopar:Npn \__xeCJK_parse_features: - { \prop_map_function:NN \g__xeCJK_features_id_prop \__xeCJK_parse_features:nn } -\cs_new_protected_nopar:Npn \__xeCJK_parse_features:nn #1#2 - { - \__xeCJK_if_font_select:nTF {#1} - { - \__xeCJK_add_font:nv {#2} { l__xeCJK_font_name_#1_tl } - \__xeCJK_if_it_or_sl:nTF {#1} - { - \__xeCJK_if_font_select:nF { bf #1 } - { \__xeCJK_add_font_if_new:nv {#2} { l__xeCJK_font_name_#1_tl } } - } - { - \str_if_eq:nnT {#1} { bf } - { - \__xeCJK_if_font_select:nF { bfit } - { \__xeCJK_add_font:nV { BoldItalic } \l__xeCJK_font_name_bf_tl } - \__xeCJK_if_font_select:nF { bfsl } - { \__xeCJK_add_font:nV { BoldSlanted } \l__xeCJK_font_name_bf_tl } - } - } - } - { \__xeCJK_set_fake_font:nn {#1} {#2} } - } -\prg_new_conditional:Npnn \__xeCJK_if_font_select:n #1 { p , T , F , TF } - { - \tl_if_blank:vTF { l__xeCJK_font_name_#1_tl } - { \prg_return_false: } { \prg_return_true: } - } -\prg_new_conditional:Npnn \__xeCJK_if_it_or_sl:n #1 { p , T , F , TF } - { - \if_predicate:w - \bool_if_p:n { \str_if_eq_p:nn { it } {#1} || \str_if_eq_p:nn { sl } {#1} } - \prg_return_true: \else: \prg_return_false: \fi: - } -\cs_generate_variant:Nn \tl_if_blank:nTF { v } -\cs_new_protected_nopar:Npn \__xeCJK_set_fake_font:nn #1#2 +\cs_new_protected_nopar:Npn \__xeCJK_parse_font_shape: { - \str_if_eq:nnTF {#1} { bf } - { \bool_if:NT \l__xeCJK_auto_fake_bold_bool { \__xeCJK_add_fake_bold:n {#1} } } + \tl_if_blank:VTF \l__xeCJK_font_name_bf_tl { - \bool_if:NTF \l__xeCJK_auto_fake_slant_bool + \bool_if:NT \l__xeCJK_auto_fake_bold_bool { - \bool_if:nT - { \__xeCJK_if_it_or_sl_p:n {#1} - || ( \str_if_eq_p:nn {#1} { bfit } - && ! ( \__xeCJK_if_font_select_p:n { it } ) ) - || ( \str_if_eq_p:nn {#1} { bfsl } - && ! ( \__xeCJK_if_font_select_p:n { sl } ) ) - } - { \__xeCJK_add_fake_slant:n {#1} } - } - { \__xeCJK_if_it_or_sl:nT {#1} { \__xeCJK_map_it_sl:nn {#1} {#2} } } - \bool_if:nT - { \l__xeCJK_auto_fake_bold_bool - && ! ( \__xeCJK_if_it_or_sl_p:n {#1} ) - && ! ( \__xeCJK_if_font_select_p:n { bf } ) + \clist_put_right:Nx \l__xeCJK_fontspec_options_clist + { AutoFakeBold = { \fp_use:N \l__xeCJK_embolden_factor_fp } } } - { \__xeCJK_add_fake_bold:n {#1} } } - \__xeCJK_add_font_if_new:nn {#2} { * } - } -\cs_new_protected_nopar:Npn \__xeCJK_map_it_sl:nn #1#2 - { - \__xeCJK_if_map_font_select:nT {#1} { - \__xeCJK_add_font:nx {#2} { \__xeCJK_get_map_font:n {#1} } - \__xeCJK_if_font_select:nF { bf #1 } - { \__xeCJK_add_font_if_new:nx { Bold #2 } { \__xeCJK_get_map_font:n {#1} } } + \clist_put_right:Nx \l__xeCJK_fontspec_options_clist + { BoldFont = { \exp_not:V \l__xeCJK_font_name_bf_tl } } } - } -\cs_new_nopar:Npn \__xeCJK_get_map_font:n #1 - { \exp_not:v { l__xeCJK_font_name_ \xeCJK_reverse:nnn {#1} { it } { sl } _tl } } -\prg_new_conditional:Npnn \__xeCJK_if_map_font_select:n #1 { p , T , F , TF } - { - \xeCJK_if_blank_x:nTF { \__xeCJK_get_map_font:n {#1} } - { \prg_return_false: } { \prg_return_true: } - } -\cs_new_protected_nopar:Npn \__xeCJK_pass_features: - { - \prop_map_inline:Nn \g__xeCJK_features_id_prop + \tl_if_blank:VTF \l__xeCJK_font_name_it_tl { - \clist_if_empty:cF { l__xeCJK_font_feat_##1_clist } + \bool_if:NT \l__xeCJK_auto_fake_slant_bool { \clist_put_right:Nx \l__xeCJK_fontspec_options_clist - { ##2Features = { \exp_not:v { l__xeCJK_font_feat_##1_clist } } } + { AutoFakeSlant = { \fp_use:N \l__xeCJK_slant_factor_fp } } } } - \prop_map_inline:Nn \l__xeCJK_add_font_prop - { \clist_put_right:Nn \l__xeCJK_fontspec_options_clist { ##1 = {##2} } } + { + \clist_put_right:Nx \l__xeCJK_fontspec_options_clist + { ItalicFont = { \exp_not:V \l__xeCJK_font_name_it_tl } } + } } \prop_new:N \g__xeCJK_family_name_prop \prop_new:N \g__xeCJK_family_font_name_prop \prop_new:N \g__xeCJK_family_font_options_prop \cs_new_protected_nopar:Npn \__xeCJK_save_family_info: { - \group_begin: \prop_gput:NVV \g__xeCJK_family_font_name_prop \l__xeCJK_family_name_tl \l__xeCJK_font_name_tl \prop_gput:NVV \g__xeCJK_family_font_options_prop \l__xeCJK_family_name_tl \l__xeCJK_font_options_clist - \group_end: } \cs_new_protected_nopar:Npn \__xeCJK_set_sub_block_family: { @@ -2888,10 +2837,14 @@ \prop_get:NVNT \g__xeCJK_family_name_prop \l__xeCJK_tmp_tl \l__xeCJK_tmp_tl { \tl_const:Nx \c__xeCJK_math_family_tl { \l__xeCJK_tmp_tl } - \DeclareSymbolFont \c__xeCJK_math_tl - \c__xeCJK_encoding_tl \c__xeCJK_math_family_tl \mddefault \shapedefault - \SetSymbolFont \c__xeCJK_math_tl { bold } - \c__xeCJK_encoding_tl \c__xeCJK_math_family_tl \bfdefault \shapedefault + \DeclareSymbolFont { \c__xeCJK_math_tl } { \c__xeCJK_encoding_tl } + { \c__xeCJK_math_family_tl } { \mddefault } { \shapedefault } + \cs_if_free:cF + { \c__xeCJK_encoding_tl/\c__xeCJK_math_family_tl/\bfdefault/\shapedefault } + { + \SetSymbolFont { \c__xeCJK_math_tl } { bold } { \c__xeCJK_encoding_tl } + { \c__xeCJK_math_family_tl } { \bfdefault } { \shapedefault } + } \int_const:Nn \c_xeCJK_math_fam_int { \use:c { sym \c__xeCJK_math_tl } } \clist_concat:NNN \l__xeCJK_tmp_clist \c__xeCJK_CJK_chars_clist \c__xeCJK_FullLeft_chars_clist @@ -2971,7 +2924,7 @@ \cs_set_eq:NN \__xeCJK_verb_CJKglue: \CJKglue \cs_set_eq:NN \__xeCJK_verb_CJKecglue: \CJKecglue \cs_set_eq:NN \__xeCJK_verb_check_for_glue: \xeCJK_check_for_glue: - \cs_set_eq:NN \__xeCJK_verb_ignore_spaces:w \xeCJK_ignore_spaces:w + \cs_set_eq:NN \__xeCJK_verb_boundary:w \xeCJK_CJK_and_Boundary:w \cs_set_protected_nopar:Npx \xeCJKOffVerbAddon { \__xeCJK_reset_char_class:n { FullLeft } @@ -2987,7 +2940,7 @@ \cs_set_eq:NN \CJKglue \__xeCJK_verb_CJKglue: \cs_set_eq:NN \CJKecglue \__xeCJK_verb_CJKecglue: \cs_set_eq:NN \xeCJK_check_for_glue: \__xeCJK_verb_check_for_glue: - \cs_set_eq:NN \xeCJK_ignore_spaces:w \__xeCJK_verb_ignore_spaces:w + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \__xeCJK_verb_boundary:w } } \tex_output:D \exp_after:wN \exp_after:wN \exp_after:wN @@ -3009,8 +2962,10 @@ \cs_set_eq:NN \CJKecglue \__xeCJK_verb_ecglue: } \cs_set_eq:NN \xeCJK_check_for_glue: \CJKecglue - \cs_set_eq:NN \xeCJK_ignore_spaces:w \CJKecglue + \cs_set_eq:NN \xeCJK_CJK_and_Boundary:w \__xeCJK_verb_CJK_and_Boundary:w } +\cs_new_protected_nopar:Npn \__xeCJK_verb_CJK_and_Boundary:w + { \xeCJK_class_group_end: \CJKecglue } \cs_new_protected_nopar:Npn \__xeCJK_verb_ccglue: { \xeCJK_no_break: \skip_horizontal:N \l__xeCJK_verb_exspace_skip } \cs_new_protected_nopar:Npn \__xeCJK_verb_ecglue: @@ -3219,7 +3174,7 @@ } \defaultCJKfontfeatures { Script = CJK } \ProcessKeysOptions { xeCJK / options } -\RequirePackage { fontspec } [ 2011/09/13 ] +\RequirePackage { fontspec } [ 2012/05/01 ] \RequirePackage { xunicode-addon } \tl_const:Nx \c__xeCJK_encoding_tl { \g_fontspec_encoding_tl } \bool_if:NT \g__xeCJK_indent_bool { \RequirePackage { indentfirst } } @@ -3278,22 +3233,67 @@ \xeCJK_set_char_class:nnn {#1} {#2} {#3} \xeCJKResetPunctClass } +\cs_if_free:NF \fontspec_setup_maths: + { + \cs_gset_protected_nopar:Npx \fontspec_setup_maths: + { + \exp_not:o + { + \fontspec_setup_maths: + \tl_if_empty:NT \g_fontspec_bfmathrm_tl + { \DeclareSymbolFontAlphabet \mathrm { operators } } + } + } + } \cs_new_protected_nopar:Npn \__xeCJK_math_robust:N #1 - { \exp_args:NNc \__xeCJK_math_robust:NN #1 { \cs_to_str:N #1 ~ } } + { \exp_args:NNc \__xeCJK_math_robust_aux:NN #1 { \cs_to_str:N #1 ~ } } +\cs_new_protected_nopar:Npn \__xeCJK_math_robust_aux:NN #1#2 + { + \exp_args:Nx \str_case:nnTF { \token_get_replacement_spec:N #1 } + { + { \x@protect #1 \protect #2 } { } + { \protect #2 } { } + } + { \__xeCJK_math_robust:NN #1#2 } + { \__xeCJK_math_robust:NN #1#1 } + } \cs_new_protected_nopar:Npn \__xeCJK_math_robust:NN #1#2 { - \bool_if:nT + \str_if_eq_x:nnTF { \token_get_arg_spec:N #2 } { } + { + \exp_args:No \tl_if_head_eq_meaning:nNTF {#2} \scan_stop: + { + \cs_gset_protected_nopar:Npx #1 + { \scan_align_safe_stop: \tl_tail:N #2 } + } + { + \cs_if_eq:NNTF #1 \ensuremath + { + \cs_gset_protected_nopar:Npx #1 + { \scan_align_safe_stop: \exp_not:o {#2} } + } + { + \__xeCJK_warning:nxx { robust-failure } + { \token_to_str:N #1 } { \token_to_meaning:N #2 } + } + } + } { - \str_if_eq_x_p:nn - { \token_get_replacement_spec:N #1 } - { \exp_not:n { \x@protect #1 \protect #2 } } && - \exp_args:Nf \tl_if_empty_p:n { \token_get_arg_spec:N #2 } && - \exp_args:No \tl_if_head_eq_meaning_p:nN {#2} \scan_stop: + \__xeCJK_warning:nxx { robust-failure } + { \token_to_str:N #1 } { \token_to_meaning:N #2 } } - { \cs_gset_protected_nopar:Npx #1 { \scan_align_safe_stop: \tl_tail:N #2 } } + } +\__xeCJK_msg_new:nnn { robust-failure } + { xeCJK~can~not~make~`#1'~robust. } + { + The~current~meaning~of~`#1'~is:\\ + \iow_indent:n {#2} } \__xeCJK_math_robust:N \( \__xeCJK_math_robust:N \) +\__xeCJK_math_robust:N \math +\__xeCJK_math_robust:N \endmath +\__xeCJK_math_robust:N \ensuremath \bool_if:nF { \xeCJK_if_package_loaded_p:n { amsmath } || @@ -3343,19 +3343,15 @@ \RenewDocumentCommand \fontfamily { m } { \tl_set:Nx \f@family {#1} - \__xeCJK_update_family:n + \__xeCJK_update_family:nn {#1} { - \str_case:nnn {#1} - { - { \rmdefault } { \xeCJK_switch_family:n { \CJKrmdefault } } - { \sfdefault } { \xeCJK_switch_family:n { \CJKsfdefault } } - { \ttdefault } { \xeCJK_switch_family:n { \CJKttdefault } } - { \familydefault } { \xeCJK_switch_family:n { \CJKfamilydefault } } - } - { } + { \rmdefault } { \xeCJK_switch_family:n { \CJKrmdefault } } + { \sfdefault } { \xeCJK_switch_family:n { \CJKsfdefault } } + { \ttdefault } { \xeCJK_switch_family:n { \CJKttdefault } } + { \familydefault } { \xeCJK_switch_family:n { \CJKfamilydefault } } } } -\cs_new_eq:NN \__xeCJK_update_family:n \use:n +\cs_new_eq:NN \__xeCJK_update_family:nn \str_case:nn \cs_new_eq:NN \xeCJK@fix@penalty \fix@penalty \tl_replace_once:Nnn \xeCJK@fix@penalty { \@@italiccorr } { \xeCJK@italiccorr } \tl_replace_once:Nnn \sw@slant { \fix@penalty } { \xeCJK@fix@penalty } @@ -3432,17 +3428,17 @@ } \cs_new_eq:NN \__xeCJK_group_begin: \group_begin: \cs_new_eq:NN \__xeCJK_group_end: \group_end: +\tl_map_inline:nn + { + \textellipsis \textemdash \textperiodcentered \textcentereddot + \textquoteleft \textquoteright \textquotedblleft \textquotedblright + } + { + \AtBeginUTFCommand [#1] { \__xeCJK_group_begin: \makexeCJKinactive } + \AtEndUTFCommand [#1] { \__xeCJK_group_end: } + } \__xeCJK_after_preamble:n { - \tl_map_inline:nn - { - \textellipsis \textemdash \textperiodcentered \textcentereddot - \textquoteleft \textquoteright \textquotedblleft \textquotedblright - } - { - \cs_gset_protected_nopar:Npx #1 - { \__xeCJK_group_begin: \makexeCJKinactive \exp_not:o {#1} \__xeCJK_group_end: } - } \tl_put_left:Nn \tipaencoding { \makexeCJKinactive } \cs_new_eq:NN \__xeCJK_aux_r:n \r \cs_set_nopar:Npn \r #1 diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty index 13dd0469dd6..bab6a2e918d 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `fntef') %% -%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -33,11 +33,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ {xeCJK patch file for ulem/CJKfntef} \ProvidesExplPackage {xeCJKfntef} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} \PassOptionsToPackage { normalem } { ulem } \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } } \ProcessOptions \scan_stop: @@ -162,6 +162,7 @@ { \xeCJK_if_ulem_patch:TF { + \xeCJK_class_group_end: \UL@stop \__xeCJK_ulem_hskip:n { \c_zero_skip } \UL@start { \xeCJK_make_node:n { CJK } } } diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty index d013fea26d2..66817b79bf6 100644 --- a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -6,7 +6,7 @@ %% %% xeCJK.dtx (with options: `xunicode') %% -%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ %% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ %% ----------------------------------------------------------------- %% Author: @@ -33,11 +33,11 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 510 2013-08-15 23:20:17Z sobenlee $ {addon file for xunicode} \ProvidesExplPackage {xunicode-addon} - {\ExplFileDate}{3.2.5}{\ExplFileDescription} + {\ExplFileDate}{3.2.6}{\ExplFileDescription} \pdftex_if_engine:T { \msg_new:nnnn { xunicode-addon } { cannot-use-pdftex } @@ -147,7 +147,7 @@ { \__xunadd_if_csname:nTF {#3} { \__xunadd_declare_character:Nnn #3 } - { \exp_args:Nc \__xunadd_declare_character:Nnn { \tl_to_str:n {#3} } } + { \__xunadd_declare_character:cnn { \tl_to_str:n {#3} } } {#1} {#2} } \cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3 @@ -162,6 +162,7 @@ } #1 { \token_to_str:N #1 } {#2} } +\cs_generate_variant:Nn \__xunadd_declare_character:Nnn { c } \cs_new_protected:Npn \__xunadd_provide_text_command_default:N #1 { \bool_if:nF @@ -175,10 +176,10 @@ { \DeclareTextCommand #2 {#4} { \__xunadd_text_character:nN {#3} {#1} } } \cs_new_protected:Npn \__xunadd_text_character:nN #1#2 { - \tl_use:N \l__xunadd_begin_hook_tl + \__xunadd_begin_hook:nn {#1} {#2} \__xunadd_glyph_if_exist:nTF { `#2 } {#2} { \cs_if_exist_use:cF { ? #1 } {#2} } - \tl_use:N \l__xunadd_end_hook_tl + \__xunadd_end_hook:nn {#1} {#2} } \cs_generate_variant:Nn \__xunadd_declare_character:NNnn { NNx } \cs_new_nopar:Npn \__xunadd_check_slot:n #1 @@ -193,7 +194,7 @@ { \__xunadd_if_csname:nTF {#3} { \__xunadd_declare_composite:Nnnn #3 } - { \exp_args:Nc \__xunadd_declare_composite:Nnnn { \tl_to_str:n {#3} } } + { \__xunadd_declare_composite:cnnn { \tl_to_str:n {#3} } } {#1} {#4} {#2} } \cs_new_protected:Npn \__xunadd_declare_composite:Nnnn #1#2#3#4 @@ -207,18 +208,38 @@ \cs_new_protected:Npn \__xunadd_chardef:Nn #1#2 { \tex_chardef:D #1 = \etex_numexpr:D #2 \scan_stop: } \cs_generate_variant:Nn \__xunadd_chardef:Nn { c } +\cs_generate_variant:Nn \__xunadd_declare_composite:Nnnn { c } +\AtEndOfPackage + { + \DeclareUTFCompositeCommand \tonebar { 25 } { \tonebar { 2 } \tonebar { 5 } } + \DeclareUTFCompositeCommand \tonebar { 52 } { \tonebar { 5 } \tonebar { 2 } } + } +\NewDocumentCommand \DeclareUTFCompositeCommand { O { \UTFencname } m m m } + { + \__xunadd_if_csname:nTF {#2} + { \__xunadd_declare_composite_command:Nnnn #2 } + { \__xunadd_declare_composite_command:cnnn { \tl_to_str:n {#2} } } + {#1} {#3} {#4} + } +\cs_new_protected:Npn \__xunadd_declare_composite_command:Nnnn #1#2#3#4 + { + \cs_set_protected:cpn + { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } + {#4} + } +\cs_generate_variant:Nn \__xunadd_declare_composite_command:Nnnn { c } \RenewDocumentCommand \DeclareEncodedCompositeCharacter { m m m m } { \__xunadd_if_csname:nTF {#2} { \__xunadd_declare_accent:Nnnn #2 } - { \exp_args:Nc \__xunadd_declare_accent:Nnnn { \tl_to_str:n {#2} } } + { \__xunadd_declare_accent:cnnn { \tl_to_str:n {#2} } } {#1} {#3} {#4} } \RenewDocumentCommand \DeclareEncodedCompositeAccents { m m m m } { \__xunadd_if_csname:nTF {#2} { \__xunadd_declare_accent:Nnnn #2 } - { \exp_args:Nc \__xunadd_declare_accent:Nnnn { \tl_to_str:n {#2} } } + { \__xunadd_declare_accent:cnnn { \tl_to_str:n {#2} } } {#1} {#4} {#3} } \cs_new_protected:Npn \__xunadd_declare_accent:Nnnn #1#2#3#4 @@ -238,24 +259,29 @@ \DeclareTextCommand #3 {#6} { \__xunadd_text_composite:nnNNn {#4} {#5} {#1} {#2} } } +\cs_generate_variant:Nn \__xunadd_declare_accent:Nnnn { c } \cs_generate_variant:Nn \__xunadd_declare_accent:NNNnnn { NNNxx } \cs_new_protected:Npn \__xunadd_text_composite:nnNNn #1#2#3#4#5 { - \tl_use:N \l__xunadd_begin_hook_tl + \__xunadd_begin_hook:nn {#2} {#5} \cs_if_exist:cTF { #1#2 - \tl_to_str:n {#5} } { - \token_if_chardef:cTF { #1#2 - \tl_to_str:n {#5} } - { - \__xunadd_glyph_if_exist:nTF { \use:c { #1#2 - \tl_to_str:n {#5} } } - { \use:c { #1#2 - \tl_to_str:n {#5} } } - { \__xunadd_add_accent:nnNN {#5} {#2} #3#4 } - } - { \use:c { #1#2 - \tl_to_str:n {#5} } } + \__xunadd_text_composite_aux:cnNNn + { #1#2 - \tl_to_str:n {#5} } {#2} {#3} {#4} {#5} } - { \__xunadd_add_accent:nnNN {#5} {#2} #3#4 } - \tl_use:N \l__xunadd_end_hook_tl + { \__xunadd_add_accent:nnNN {#5} {#2} {#3} {#4} } + \__xunadd_end_hook:nn {#2} {#5} } -\cs_generate_variant:Nn \token_if_chardef:NTF { c } +\cs_new_protected:Npn \__xunadd_text_composite_aux:NnNNn #1#2#3#4#5 + { + \token_if_chardef:NTF #1 + { + \__xunadd_glyph_if_exist:nTF {#1} + {#1} { \__xunadd_add_accent:nnNN {#5} {#2} {#3} {#4} } + } + {#1} + } +\cs_generate_variant:Nn \__xunadd_text_composite_aux:NnNNn { c } \cs_new_protected:Npn \__xunadd_add_accent:nnNN #1#2#3#4 { \tl_if_blank:nTF {#1} @@ -280,20 +306,56 @@ } } } -\NewDocumentCommand \AtBeginUTFCommand { s +m } +\NewDocumentCommand \AtBeginUTFCommand { s O { } +m } { - \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_begin_hook_tl {#2} } - { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#2} } + \tl_if_blank:nTF {#2} + { + \IfBooleanTF {#1} + { \tl_set:Nn \l__xunadd_begin_hook_tl {#3} } + { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#3} } + } + { \__xunadd_set_cmd_hook:nnn { begin } {#2} {#3} } } -\NewDocumentCommand \AtEndUTFCommand { s +m } +\NewDocumentCommand \AtEndUTFCommand { s O { } +m } { - \IfBooleanTF {#1} - { \tl_set:Nn \l__xunadd_end_hook_tl {#2} } - { \tl_put_right:Nn \l__xunadd_end_hook_tl {#2} } + \tl_if_blank:nTF {#2} + { + \IfBooleanTF {#1} + { \tl_set:Nn \l__xunadd_end_hook_tl {#3} } + { \tl_put_right:Nn \l__xunadd_end_hook_tl {#3} } + } + { \__xunadd_set_cmd_hook:nnn { end } {#2} {#3} } } \tl_new:N \l__xunadd_begin_hook_tl \tl_new:N \l__xunadd_end_hook_tl +\cs_new_protected:Npn \__xunadd_set_cmd_hook:nnn #1#2#3 + { + \cs_set_protected:cpn + { + \tl_if_single:nTF {#2} + { \use:c { __xunadd_#1_csname:n } { \token_to_str:N #2 } } + { \__xunadd_set_cmd_hook_aux:Nnwn #2 \q_stop {#1} } + } ##1 + {#3} + } +\cs_new:Npn \__xunadd_set_cmd_hook_aux:Nnwn #1#2 \q_stop #3 + { \use:c { __xunadd_#3_csname:n } { \token_to_str:N #1 - \tl_to_str:n {#2} } } +\cs_new_nopar:Npn \__xunadd_begin_csname:n #1 { __xunadd_begin_#1_hook:n } +\cs_new_nopar:Npn \__xunadd_end_csname:n #1 { __xunadd_end_#1_hook:n } +\cs_new_protected:Npn \__xunadd_begin_hook:nn #1#2 + { + \tl_use:N \l__xunadd_begin_hook_tl + \cs_if_exist_use:cF { \__xunadd_begin_csname:n { #1 - \tl_to_str:n {#2} } } + { \cs_if_exist_use:cF { \__xunadd_begin_csname:n {#1} } { \use_none:n } } + {#2} + } +\cs_new_protected:Npn \__xunadd_end_hook:nn #1#2 + { + \cs_if_exist_use:cF { \__xunadd_end_csname:n { #1 - \tl_to_str:n {#2} } } + { \cs_if_exist_use:cF { \__xunadd_end_csname:n {#1} } { \use_none:n } } + {#2} + \tl_use:N \l__xunadd_end_hook_tl + } %% %% This package consists of the file xeCJK.dtx, %% full-stop.map, -- cgit v1.2.3