From 81f3a7b776ea8fe83f4dbbe5ebf2d78648af9497 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 26 Jul 2013 23:10:53 +0000 Subject: xecjk (26jul13) git-svn-id: svn://tug.org/texlive/trunk@31290 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg | 4 +- .../tex/xelatex/xecjk/xeCJK-listings.sty | 19 +- Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty | 395 +++++++++++++-------- Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty | 26 +- .../tex/xelatex/xecjk/xunicode-addon.sty | 326 +++++++++++++++++ 5 files changed, 616 insertions(+), 154 deletions(-) create mode 100644 Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg b/Master/texmf-dist/tex/xelatex/xecjk/config/xeCJK.cfg index 599b26f011d..2e32945e9bf 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 465 2013-07-06 10:30:24Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ {Configuration file for xeCJK package} \ProvidesExplFile {\ExplFileName.cfg} - {\ExplFileDate}{3.2.4}{\ExplFileDescription} + {\ExplFileDate}{3.2.5}{\ExplFileDescription} %% %% diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK-listings.sty index 501f65e5be8..a3953c92c43 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 465 2013-07-06 10:30:24Z sobenlee $ +%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z 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 465 2013-07-06 10:30:24Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ {xeCJK patch file for listings} \ProvidesExplPackage {xeCJK-listings} - {\ExplFileDate}{3.2.4}{\ExplFileDescription} + {\ExplFileDate}{3.2.5}{\ExplFileDescription} \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { xeCJK } } \ProcessOptions \scan_stop: \RequirePackage { xeCJK } @@ -310,13 +310,18 @@ } { \ } %% -%% This package consists of the file xeCJK.dtx +%% This package consists of the file xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, %% and the derived files xeCJK.pdf, %% xeCJK.sty, %% xeCJK.cfg, %% xeCJK.ins, %% xeCJKfntef.sty, %% xeCJK-listings.sty, +%% xunicode-addon.sty, %% xeCJK-example-autofake.tex, %% xeCJK-example-fallback.tex, %% xeCJK-example-subCJKblock.tex, @@ -326,7 +331,11 @@ %% xeCJK-example-punctstyle.tex, %% xeCJK-example-verbatim.tex, %% xeCJK-example-IVS.tex, -%% xeCJK-example-listings.tex, and +%% xeCJK-example-listings.tex, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and %% README.txt. %% %% End of file `xeCJK-listings.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJK.sty index 86734bccd7d..629aaf9d8dd 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 465 2013-07-06 10:30:24Z sobenlee $ +%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z 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 465 2013-07-06 10:30:24Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ {Typesetting CJK scripts with XeLaTeX} \ProvidesExplPackage {\ExplFileName} - {\ExplFileDate}{3.2.4}{\ExplFileDescription} + {\ExplFileDate}{3.2.5}{\ExplFileDescription} \msg_new:nnn { xeCJK } { Require-XeTeX } { The~xeCJK~package~requires~XeTeX~to~function.\\\\ @@ -46,23 +46,33 @@ Loading~xeCJK~will~abort! } \xetex_if_engine:F { \msg_critical:nn { xeCJK } { Require-XeTeX } } +\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } + { + \tl_if_exist:cTF { ver@ #1 . \c__xeCJK_package_ext_tl } + { \prg_return_true: } { \prg_return_false: } + } +\tl_const:Nx \c__xeCJK_package_ext_tl { \@pkgextension } \msg_new:nnn { xeCJK } { incompatible-package } { The~`#1'~package~and~xeCJK~are~incompatible.\\\\ - Please ~ \str_if_eq:nnTF {#1} { CJKnumb } - { load~it~after~xeCJK. } { do~not~use~it. } + Please~do~not~use~it. } -\clist_map_inline:nn { CJKnumb , CJKulem , CJKvert , CJKpunct , CJKutf8 , CJK } +\msg_new:nnn { xeCJK } { after-package } { - \@ifpackageloaded {#1} + The~`#1'~package~and~xeCJK~are~incompatible.\\\\ + Please~load~it~after~xeCJK. + } +\clist_map_inline:nn { CJKfntef , CJKnumb } + { + \xeCJK_if_package_loaded:nT {#1} + { \msg_error:nnn { xeCJK } { after-package } {#1} } + } +\clist_map_inline:nn { CJKulem , CJKvert , CJKpunct , CJKutf8 , CJK } + { + \xeCJK_if_package_loaded:nTF {#1} { \msg_error:nnn { xeCJK } { incompatible-package } {#1} } - { } + { \tl_const:cn { ver@ #1 . \c__xeCJK_package_ext_tl } { 9999/99/99 } } } -\tl_gset:cn { ver@CJK.sty } { 9999/99/99 } -\tl_gset_eq:cc { ver@CJKutf8.sty } { ver@CJK.sty } -\tl_gset_eq:cc { ver@CJKvert.sty } { ver@CJK.sty } -\tl_gset_eq:cc { ver@CJKulem.sty } { ver@CJK.sty } -\tl_gset_eq:cc { ver@CJKpunct.sty } { ver@CJK.sty } \msg_new:nnn { xeCJK } { l3-too-old } { Support~package~`#1'~too~old. \\\\ @@ -84,22 +94,16 @@ \bool_new:N \l__xeCJK_tmp_bool \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_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 } } -\cs_new_protected_nopar:Npn \__xeCJK_warning:nx { \msg_warning:nnx { xeCJK } } -\cs_new_protected_nopar:Npn \__xeCJK_warning:nxx { \msg_warning:nnxx { xeCJK } } -\cs_new_protected_nopar:Npn \__xeCJK_info:nx { \msg_info:nnx { xeCJK } } -\cs_new_protected_nopar:Npn \__xeCJK_info:nxx { \msg_info:nnxx { xeCJK } } +\cs_new_protected_nopar:Npn \__xeCJK_msg_new:nn { \msg_new:nnn { 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 } } +\cs_new_protected_nopar:Npn \__xeCJK_warning:nx { \msg_warning:nnx { xeCJK } } +\cs_new_protected_nopar:Npn \__xeCJK_warning:nxx { \msg_warning:nnxx { xeCJK } } +\cs_new_protected_nopar:Npn \__xeCJK_warning:nxxx { \msg_warning:nnxxx { xeCJK } } +\cs_new_protected_nopar:Npn \__xeCJK_info:nxx { \msg_info:nnxx { xeCJK } } \cs_new_protected_nopar:Npn \xeCJK_allow_break: { \tex_penalty:D \c_zero } \cs_new_protected_nopar:Npn \xeCJK_no_break: { \tex_penalty:D \c_ten_thousand } -\prg_new_conditional:Npnn \xeCJK_if_package_loaded:n #1 { p , T , F , TF } - { - \tl_if_exist:cTF { ver@ #1 . \c__xeCJK_package_ext_tl } - { \prg_return_true: } { \prg_return_false: } - } -\tl_const:Nx \c__xeCJK_package_ext_tl { \@pkgextension } \tl_new:N \g__xeCJK_at_end_preamble_hook_tl \tl_new:N \g__xeCJK_after_preamble_hook_tl \tl_new:N \g__xeCJK_after_end_preamble_hook_tl @@ -591,7 +595,12 @@ { \seq_map_function:NN \g__xeCJK_CJK_class_seq \__xeCJK_clear_Boundary_and_CJK_toks:n } \cs_new_protected_nopar:Npn \__xeCJK_clear_Boundary_and_CJK_toks:n #1 { \xeCJK_clear_inter_class_toks:nn { Boundary } {#1} } -\cs_new_eq:NN \xeCJK_class_group_begin: \c_group_begin_token +\cs_new_protected_nopar:Npn \xeCJK_class_group_begin: + { + \c_group_begin_token + \bool_set_true:N \l__xeCJK_CJK_group_bool + } +\bool_new:N \l__xeCJK_CJK_group_bool \cs_new_eq:NN \xeCJK_class_group_end: \c_group_end_token \AtEndOfPackage { @@ -618,11 +627,10 @@ } \xeCJK_inter_class_toks:nnn { CJK } {#1} { \xeCJK_class_group_end: } } -\clist_map_inline:nn { Default , HalfLeft , NormalSpace } +\clist_map_inline:nn { Default , HalfLeft } { \xeCJK_inter_class_toks:nnn { Boundary } {#1} { \xeCJK_Boundary_and_Default: } - \str_if_eq:nnF {#1} { NormalSpace } - { \xeCJK_app_inter_class_toks:nnn { CJK } {#1} { \CJKecglue } } + \xeCJK_app_inter_class_toks:nnn { CJK } {#1} { \CJKecglue } } \cs_new_protected_nopar:Npn \xeCJK_Boundary_and_Default: { @@ -654,7 +662,7 @@ } } } -\clist_map_inline:nn { Default , HalfRight , NormalSpace } +\clist_map_inline:nn { Default , HalfRight } { \xeCJK_inter_class_toks:nnn {#1} { Boundary } { @@ -667,8 +675,42 @@ { { \xeCJK_make_node:n { default } } } } } - \str_if_eq:nnF {#1} { NormalSpace } - { \xeCJK_pre_inter_class_toks:nnn {#1} { CJK } { \CJKecglue } } + \xeCJK_pre_inter_class_toks:nnn {#1} { CJK } { \CJKecglue } + } +\xeCJK_inter_class_toks:nnn { Boundary } { NormalSpace } + { \xeCJK_Boundary_and_NormalSp: } +\cs_new_protected_nopar:Npn \xeCJK_Boundary_and_NormalSp: + { + \bool_if:nTF + { + \l__xeCJK_xecglue_bool && + \int_compare_p:nNn \etex_lastnodetype:D = \c_eleven && + \skip_if_eq_p:nn \tex_lastskip:D \c_xeCJK_space_skip_tl + } + { + \tex_unskip:D + \bool_if:nTF + { + \xeCJK_if_last_node_p:n { CJK } || + \xeCJK_if_last_node_p:n { CJK-space } + } + { \xeCJK_remove_node: \CJKecglue } { ~ } + } + { + \xeCJK_if_last_node:nT { CJK-space } + { \xeCJK_remove_node: \xeCJK_space_or_xecglue: } + } + } +\xeCJK_inter_class_toks:nnn { NormalSpace } { Boundary } + { + \int_gset_eq:NN \g__xeCJK_spacefactor_int \tex_spacefactor:D + \peek_meaning_remove:NTF \tex_italiccorrection:D + { \tex_italiccorrection:D { \xeCJK_make_node:n { normalspace } } } + { + \token_if_space:NTF \l_peek_token + { { \xeCJK_make_node:n { default-space } } } + { { \xeCJK_make_node:n { normalspace } } } + } } \xeCJK_inter_class_toks:nnn { Boundary } { CJK } { @@ -751,6 +793,7 @@ \xeCJK_def_node:nn { default } { 13 sp } \xeCJK_def_node:nn { default-space } { 14 sp } \xeCJK_def_node:nn { CJK-nobreak } { 15 sp } +\xeCJK_def_node:nn { normalspace } { 16 sp } \keys_define:nn { xeCJK / options } { CJKglue .code:n = @@ -947,15 +990,40 @@ { \int_case:nnn { \etex_lastnodetype:D } { - { \c_one } { \__xeCJK_zero_glue: \use_none:n } + { \c_one } + { + \box_set_to_last:N \l__xeCJK_tmp_box + \bool_if:nTF + { + \int_compare_p:nNn \etex_lastnodetype:D = \c_minus_one && + \dim_compare_p:nNn { \box_wd:N \l__xeCJK_tmp_box } = \tex_parindent:D + } + { \box_use_clear:N \l__xeCJK_tmp_box \use_none:n } + { \box_use_clear:N \l__xeCJK_tmp_box \use:n } + } { \c_minus_one } { \use_none:n } { \c_eleven } { - \bool_if:nF + \bool_if:nTF { ! ( \skip_if_finite_p:n { \tex_lastskip:D } ) || \skip_if_eq_p:nn { \tex_lastskip:D } { 1 sp } } + { \use_none:n } + { + \skip_if_eq:nnTF { \tex_lastskip:D } { \labelsep } + { + \tex_unskip:D + \bool_if:nTF + { + \int_compare_p:nNn \etex_lastnodetype:D = \c_thirteen && + \int_compare_p:nNn \tex_lastpenalty:D = \c_zero + } + { \skip_horizontal:n { \labelsep } \use_none:n } + { \skip_horizontal:n { \labelsep } \use:n } + } + { \use:n } + } } { \c_thirteen } { @@ -1421,16 +1489,25 @@ { \__xeCJK_switch_font:nn {#2} {#1} } } } -\__xeCJK_msg_new:nn { XeTeX-too-old } - { - \token_to_str:N \XeTeXglyphbounds \ is~not~defined.\\ - CJK~punctuation~kerning~will~not~be~available.\\\\ - You~have~to~update~XeTeX~to~the~version~0.9995.0~or~later. - } \cs_if_exist:NF \XeTeXglyphbounds { + \__xeCJK_msg_new:nn { XeTeX-too-old } + { + \token_to_str:N \XeTeXglyphbounds \ is~not~defined.\\ + CJK~punctuation~kerning~will~not~be~available.\\\\ + You~have~to~update~XeTeX~to~the~version~0.9995.0~or~later. + } \__xeCJK_error:n { XeTeX-too-old } - \__xeCJK_after_end_preamble:n { \xeCJKsetup { PunctStyle = plain } } + \AtEndOfPackage + { + \keys_define:nn { xeCJK / options } + { + PunctStyle / unknown .code:n = + { \__xeCJK_error:nx { punct-style-unknown } { \l_keys_value_tl } } + } + \seq_gclear:N \g__xeCJK_punct_style_seq + \xeCJKsetup { PunctStyle = plain } + } } \NewDocumentCommand \xeCJKsetwidth { m m } { \tl_map_inline:xn {#1} { \tl_gset:cn { g__xeCJK_punct_width/##1/tl } {#2} } } @@ -1525,10 +1602,10 @@ { \tl_use:c { \__xeCJK_punct_dim_csname:nn {#1} {#2} } } \cs_new_nopar:Npn \__xeCJK_use_punct_dim:nnn #1#2#3 { \tl_use:c { \__xeCJK_punct_dim_csname:nnn {#1} {#2} {#3} } } -\cs_new_protected_nopar:Npn \__xeCJK_gset_punct_dim:nnx #1#2#3 - { \tl_const:cx { \__xeCJK_punct_dim_csname:nn {#1} {#2} } {#3} } -\cs_new_protected_nopar:Npn \__xeCJK_gset_punct_dim:nnnx #1#2#3#4 - { \tl_const:cx { \__xeCJK_punct_dim_csname:nnn {#1} {#2} {#3} } {#4} } +\cs_new_protected_nopar:Npn \__xeCJK_save_punct_dim:nnn #1#2#3 + { \tl_const:cx { \__xeCJK_punct_dim_csname:nn {#1} {#2} } { \dim_eval:n {#3} } } +\cs_new_protected_nopar:Npn \__xeCJK_save_punct_dim:nnnn #1#2#3#4 + { \tl_const:cx { \__xeCJK_punct_dim_csname:nnn {#1} {#2} {#3} } { \dim_eval:n {#4} } } \DeclareObjectType { xeCJK / punctuation } { \c_three } \DeclareTemplateInterface { xeCJK / punctuation } { basic } { \c_three } { @@ -1629,7 +1706,7 @@ } } } - \__xeCJK_gset_punct_dim:nnnx { glue } {#1} {#2} + \__xeCJK_save_punct_dim:nnnn { glue } {#1} {#2} { \dim_max:nn { \l__xeCJK_margin_minimum_dim } @@ -1709,24 +1786,21 @@ } \cs_new_protected_nopar:Npn \xeCJK_punct_kerning_process:NN #1#2 { - \__xeCJK_gset_punct_dim:nnnx { kern } {#1} {#2} + \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#2} { - \dim_eval:n + \bool_if:nTF { - \bool_if:nTF - { - \l__xeCJK_enabled_global_setting_bool && - \tl_if_exist_p:c { g__xeCJK_punct/kern/#1/#2/tl } - } - { \tl_use:c { g__xeCJK_punct/kern/#1/#2/tl } } - { - \bool_if:NTF \l__xeCJK_enabled_kerning_bool - { \__xeCJK_calc_kerning_margin:NN {#1} {#2} } - { \__xeCJK_original_kerning_margin:NN {#1} {#2} } - } - - ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_right_tl {#1} ) - - ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_left_tl {#2} ) + \l__xeCJK_enabled_global_setting_bool && + \tl_if_exist_p:c { g__xeCJK_punct/kern/#1/#2/tl } + } + { \tl_use:c { g__xeCJK_punct/kern/#1/#2/tl } } + { + \bool_if:NTF \l__xeCJK_enabled_kerning_bool + { \__xeCJK_calc_kerning_margin:NN {#1} {#2} } + { \__xeCJK_original_kerning_margin:NN {#1} {#2} } } + - ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_right_tl {#1} ) + - ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_left_tl {#2} ) } } \cs_new_nopar:Npn \__xeCJK_original_kerning_margin:NN #1#2 @@ -1829,14 +1903,14 @@ { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl { - \__xeCJK_gset_punct_dim:nnnx { glue } {#1} {#2} { \c_zero_dim } - \__xeCJK_gset_punct_dim:nnnx { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim } - \__xeCJK_gset_punct_dim:nnnx { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim } + \__xeCJK_save_punct_dim:nnnn { glue } {#1} {#2} { \c_zero_dim } + \__xeCJK_save_punct_dim:nnnn { bound } \c__xeCJK_left_tl {#2} { \c_zero_dim } + \__xeCJK_save_punct_dim:nnnn { bound } \c__xeCJK_right_tl {#2} { \c_zero_dim } } { { \xeCJK_select_font: \xeCJK_calc_punct_dimen:f {#2} } \__xeCJK_punct_if_long:NTF {#2} - { \__xeCJK_gset_punct_dim:nnnx { glue } {#1} {#2} { \c_zero_dim } } + { \__xeCJK_save_punct_dim:nnnn { glue } {#1} {#2} { \c_zero_dim } } { \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } {#1} {#2} { } @@ -1846,22 +1920,22 @@ } \cs_new_protected_nopar:Npn \xeCJK_calc_punct_dimen:N #1 { - \__xeCJK_gset_punct_dim:nnnx { bound } \c__xeCJK_left_tl {#1} + \__xeCJK_save_punct_dim:nnnn { bound } \c__xeCJK_left_tl {#1} { \xeCJK_glyph_bounds:NN \c_one {#1} } - \__xeCJK_gset_punct_dim:nnnx { bound } \c__xeCJK_right_tl {#1} + \__xeCJK_save_punct_dim:nnnn { bound } \c__xeCJK_right_tl {#1} { \xeCJK_glyph_bounds:NN \c_three {#1} } \dim_set:Nn \l__xeCJK_tmp_dim { ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_left_tl {#1} ) + ( \__xeCJK_use_punct_dim:nnn { bound } \c__xeCJK_right_tl {#1} ) } - \__xeCJK_gset_punct_dim:nnx { width } {#1} - { \dim_use:N \etex_fontcharwd:D \tex_font:D \xeCJK_token_value_charcode:N #1 } - \__xeCJK_gset_punct_dim:nnx { dimen } {#1} - { \dim_eval:n { \__xeCJK_use_punct_dim:nn { width } {#1} - \l__xeCJK_tmp_dim } } + \__xeCJK_save_punct_dim:nnn { width } {#1} + { \etex_fontcharwd:D \tex_font:D \xeCJK_token_value_charcode:N #1 } + \__xeCJK_save_punct_dim:nnn { dimen } {#1} + { \__xeCJK_use_punct_dim:nn { width } {#1} - \l__xeCJK_tmp_dim } \__xeCJK_punct_if_long:NT {#1} { - \__xeCJK_gset_punct_dim:nnnx { kern } {#1} {#1} + \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#1} { \bool_if:nTF { @@ -1869,7 +1943,7 @@ \str_if_eq_p:nn {#1} { ^^^^2026 } } { \c_zero_dim } - { - \dim_use:N \l__xeCJK_tmp_dim } + { - \l__xeCJK_tmp_dim } } } } @@ -1884,7 +1958,7 @@ \tl_if_exist:cF { \__xeCJK_punct_dim_csname:nnn { kern } {#1} {#2} } { \tl_if_eq:NNTF \l_xeCJK_punct_style_tl \c__xeCJK_punct_style_plain_tl - { \__xeCJK_gset_punct_dim:nnnx { kern } {#1} {#2} { \c_zero_dim } } + { \__xeCJK_save_punct_dim:nnnn { kern } {#1} {#2} { \c_zero_dim } } { \UseInstance { xeCJK / punctuation } { \l_xeCJK_punct_style_tl } { } {#1} {#2} @@ -1921,8 +1995,8 @@ { \IfInstanceExistTF { xeCJK / punctuation } {#1} { \__xeCJK_warning:nx { punct-style-already-defined } {#1} } - { \seq_gput_right:Nn \g__xeCJK_punct_style_seq {#1} } - \DeclareInstance { xeCJK / punctuation } {#1} { basic } {#2} + { \seq_gput_right:Nx \g__xeCJK_punct_style_seq {#1} } + \exp_args:Nnx \DeclareInstance { xeCJK / punctuation } {#1} { basic } {#2} } \seq_new:N \g__xeCJK_punct_style_seq \__xeCJK_msg_new:nn { punct-style-already-defined } @@ -1934,7 +2008,7 @@ \NewDocumentCommand \xeCJKEditPunctStyle { > { \TrimSpaces } m m } { \IfInstanceExistTF { xeCJK / punctuation } {#1} - { \EditInstance { xeCJK / punctuation } {#1} {#2} } + { \exp_args:Nnx \EditInstance { xeCJK / punctuation } {#1} {#2} } { \__xeCJK_error:nx { punct-style-unknown } {#1} } } \@onlypreamble \xeCJKEditPunctStyle @@ -2005,11 +2079,9 @@ { \str_if_eq_x:nnTF { \CJKfamilydefault } { \l_xeCJK_family_tl } { - \use:x - { - \msg_warning:nnnnn { xeCJK } { missing-glyph } - { \l__xeCJK_fallback_family_tl } {#1} { \int_to_hexadecimal:n { `#1 } } - } + \__xeCJK_warning:nxxx { missing-glyph } + { \l__xeCJK_fallback_family_tl } {#1} + { \int_to_hexadecimal:n { `#1 } } \__xeCJK_fallback_save_CJKsymbol:N {#1} } { @@ -2506,7 +2578,7 @@ \prop_gput:Nxx \g__xeCJK_family_name_prop {#1} {#2} \cs_gset_protected_nopar:cpx { \__xeCJK_family_nfss_csname:n {#1} } { - \tl_set:Nx \exp_not:N \f@encoding { \c__xeCJK_encoding_tl } + \exp_not:N \fontencoding { \c__xeCJK_encoding_tl } \tl_set:Nx \exp_not:N \f@family {#2} \exp_not:N \selectfont } @@ -2842,35 +2914,36 @@ \int_incr:N \l__xeCJK_begin_int } } +\int_new:N \l__xeCJK_verb_case_int \keys_define:nn { xeCJK / options } { - Verb .choice: , - Verb / true .code:n = { \int_set_eq:NN \l__xeCJK_verb_case_int \c_zero } , - Verb / env .code:n = { \int_set_eq:NN \l__xeCJK_verb_case_int \c_one } , - Verb / env+ .code:n = { \int_set_eq:NN \l__xeCJK_verb_case_int \c_two } , - Verb / false .code:n = { \int_set_eq:NN \l__xeCJK_verb_case_int \c_three } , - Verb .default:n = { env } + Verb .choices:nn = + { true , env , env+ , false } + { \int_set_eq:NN \l__xeCJK_verb_case_int \l_keys_choice_int } , + Verb .default:n = { env } } -\int_new:N \l__xeCJK_verb_case_int -\__xeCJK_after_preamble:n +\cs_new_protected_nopar:Npn \__xeCJK_verb_font_hook: { - \tl_put_right:Nn \verbatim@font - { - \if_case:w \l__xeCJK_verb_case_int + \if_case:w \l__xeCJK_verb_case_int + \or: + \cs_set_eq:NN \CJKglue \__xeCJK_zero_glue: + \cs_set_eq:NN \CJKecglue \__xeCJK_zero_glue: + \or: + \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen + { \xeCJKVerbAddon } + { \cs_set_eq:NN \CJKglue \__xeCJK_zero_glue: \cs_set_eq:NN \CJKecglue \__xeCJK_zero_glue: - \or: - \int_compare:nNnTF \etex_currentgrouptype:D = \c_fourteen - { \xeCJKVerbAddon } - { - \cs_set_eq:NN \CJKglue \__xeCJK_zero_glue: - \cs_set_eq:NN \CJKecglue \__xeCJK_zero_glue: - } - \or: - \int_compare:nNnT \etex_currentgrouptype:D = \c_fourteen - { \xeCJKVerbAddon } - \fi: - } + } + \or: + \int_compare:nNnT \etex_currentgrouptype:D = \c_fourteen + { \xeCJKVerbAddon } + \fi: + } +\__xeCJK_after_preamble:n + { + \cs_set_protected_nopar:Npx \verbatim@font + { \exp_not:o { \verbatim@font } \__xeCJK_verb_font_hook: } } \NewDocumentCommand \xeCJKVerbAddon { } { @@ -2906,7 +2979,6 @@ \__xeCJK_reset_char_class:n { HalfLeft } \__xeCJK_reset_char_class:n { HalfLeft } \__xeCJK_reset_char_class:n { NormalSpace } - \skip_set:Nn \tex_rightskip:D { \skip_use:N \tex_rightskip:D } \exp_not:c { bool_set_ \bool_if:NTF \l__xeCJK_xecglue_bool { true } { false } :N } \l__xeCJK_xecglue_bool @@ -2926,15 +2998,23 @@ \tex_the:D \tex_output:D } \xeCJKsetup { xCJKecglue = false } - \cs_set_protected_nopar:Npn \CJKglue - { \skip_horizontal:N \l__xeCJK_verb_exspace_skip } - \cs_set_protected_nopar:Npn \CJKecglue - { \skip_horizontal:n { 0.5 \l__xeCJK_verb_exspace_skip } } - \cs_set_eq:NN \xeCJK_check_for_glue: \CJKecglue - \cs_set_eq:NN \xeCJK_ignore_spaces:w \CJKecglue - \skip_set:Nn \tex_rightskip:D { \c_zero_dim plus 1 fil } } + \skip_if_eq:nnTF { \l__xeCJK_verb_exspace_skip } { \c_zero_skip } + { + \xeCJK_cs_clear:N \CJKglue + \xeCJK_cs_clear:N \CJKecglue + } + { + \cs_set_eq:NN \CJKglue \__xeCJK_verb_ccglue: + \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_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: + { \xeCJK_no_break: \skip_horizontal:n { 0.5 \l__xeCJK_verb_exspace_skip } } \cs_new_protected_nopar:Npn \__xeCJK_reset_char_class:n #1 { \int_set:Nn \l__xeCJK_tmp_int { \xeCJK_class_num:n {#1} } @@ -2989,8 +3069,8 @@ { \fp_set:Nn \l__xeCJK_scale_factor_fp { #1 / #2 } \__xeCJK_warning:nxx { scale-factor } - { \fp_eval:n { round - ( \l__xeCJK_scale_factor_fp , 2 ) } } - { \fp_eval:n { round + ( #2 / #1 , 2 ) } } + { \fp_eval:n { round - ( \l__xeCJK_scale_factor_fp , 4 ) } } + { \fp_eval:n { round + ( #2 / #1 , 4 ) } } \xeCJK_add_font_features:Nnx \c_true_bool { } { Scale = { \fp_use:N \l__xeCJK_scale_factor_fp } } \prop_gput:NVV \g__xeCJK_scale_family_prop @@ -3007,17 +3087,29 @@ } \fp_new:N \l__xeCJK_scale_factor_fp \prop_new:N \g__xeCJK_scale_family_prop +\cs_new_protected_nopar:Npn \xeCJK_visible_space: + { + \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } + \xeCJK_glyph_if_exist:NTF { ^^^^2423 } + { ^^^^2423 } + { + \int_compare:nNnTF { \XeTeXfonttype \tex_font:D } = \c_zero + { + \str_if_eq_x:nnTF { \f@family } { \ttdefault } + { \c_catcode_other_space_tl } + { \textvisiblespace } + } + { \xeCJK_visible_space_fallback: } + } + } +\AtEndOfPackage + { \cs_gset_eq:NN \fontspec_visible_space: \xeCJK_visible_space: } \cs_new_protected_nopar:Npn \xeCJK_visible_space_fallback: { { \cs_if_exist_use:cF { xeCJK/space/\curr@fontshape/\f@size } { \xeCJK_set_visible_space_font: } - \textvisiblespace + ^^^^2423 } } -\AtEndOfPackage - { - \tl_put_left:Nn \fontspec_visible_space: { \scan_stop: } - \cs_gset_eq:NN \fontspec_visible_space_fallback: \xeCJK_visible_space_fallback: - } \cs_new_protected_nopar:Npn \xeCJK_set_visible_space_font: { \tl_set:Nx \l__xeCJK_current_coor_tl { xeCJK/space/\curr@fontshape/\f@size } @@ -3027,7 +3119,7 @@ } \cs_new_protected_nopar:Npn \__xeCJK_set_visible_space_size:n #1 { - \tl_set:Nx \f@encoding { \g_fontspec_encoding_tl } + \fontencoding { \g_fontspec_encoding_tl } \tl_set:Nx \f@family { lmtt } \selectfont \dim_compare:nNnF {#1} = { \tex_fontdimen:D \c_two \tex_font:D } @@ -3128,6 +3220,7 @@ \defaultCJKfontfeatures { Script = CJK } \ProcessKeysOptions { xeCJK / options } \RequirePackage { fontspec } [ 2011/09/13 ] +\RequirePackage { xunicode-addon } \tl_const:Nx \c__xeCJK_encoding_tl { \g_fontspec_encoding_tl } \bool_if:NT \g__xeCJK_indent_bool { \RequirePackage { indentfirst } } \keys_define:nn { xeCJK / options } @@ -3147,7 +3240,7 @@ \tl_if_exist:NF \CJKttdefault { \tl_gset:Nn \CJKttdefault { tt } } \tl_new:N \l__xeCJK_family_default_init_tl \cs_new_eq:NN \__xeCJK_family_default_wrap:n \use:n -\tl_gset:Nx \l__xeCJK_family_default_init_tl +\tl_set:Nx \l__xeCJK_family_default_init_tl { \exp_not:N \__xeCJK_family_default_wrap:n { @@ -3185,25 +3278,34 @@ \xeCJK_set_char_class:nnn {#1} {#2} {#3} \xeCJKResetPunctClass } -\cs_if_exist:cT { ? - \token_to_str:N \nobreakspace } +\cs_new_protected_nopar:Npn \__xeCJK_math_robust:N #1 + { \exp_args:NNc \__xeCJK_math_robust:NN #1 { \cs_to_str:N #1 ~ } } +\cs_new_protected_nopar:Npn \__xeCJK_math_robust:NN #1#2 { - \exp_args:NNv \ProvideTextCommandDefault \nobreakspace - { ? - \token_to_str:N \nobreakspace } + \bool_if:nT + { + \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: + } + { \cs_gset_protected_nopar:Npx #1 { \scan_align_safe_stop: \tl_tail:N #2 } } } -\cs_new_nopar:Npn \xeCJK@text@composite #1#2#3 \@text@composite +\__xeCJK_math_robust:N \( +\__xeCJK_math_robust:N \) +\bool_if:nF { - \str_if_eq:nnTF {#3} { \@empty } - { \orig@text@composite #1#2#3 \@text@composite } - { \__xeCJK_text_composite:Nnw #1#2#3 } + \xeCJK_if_package_loaded_p:n { amsmath } || + \xeCJK_if_package_loaded_p:n { amsthm } } -\cs_new_nopar:Npn \__xeCJK_text_composite:Nnw #1#2 \@empty { - \tl_if_empty:nTF {#2} - { \orig@text@composite #1 \@empty \@text@composite } - { \cs_if_exist_use:cF { \token_to_str:N #1 - \token_to_str:N #2 } } + \__xeCJK_math_robust:N \[ + \__xeCJK_math_robust:N \] } -\cs_new_eq:NN \orig@text@composite \@text@composite -\cs_set_eq:NN \@text@composite \xeCJK@text@composite +\UndeclareTextCommand \nobreakspace { \UTFencname } +\RenewDocumentCommand \nobreakspace { } { \leavevmode \nobreak \ } +\AtBeginUTFCommand { \bool_if:NT \l__xeCJK_CJK_group_bool { \scan_stop: } } \__xeCJK_msg_new:nn { conflict-package } { The~`#1'~package~is~too~old. \\ @@ -3338,7 +3440,7 @@ \textquoteleft \textquoteright \textquotedblleft \textquotedblright } { - \cs_gset_nopar:Npx #1 + \cs_gset_protected_nopar:Npx #1 { \__xeCJK_group_begin: \makexeCJKinactive \exp_not:o {#1} \__xeCJK_group_end: } } \tl_put_left:Nn \tipaencoding { \makexeCJKinactive } @@ -3444,13 +3546,18 @@ { \g__xeCJK_config_name_tl } [ ] [ ] { \c__xeCJK_config_ext_tl } } %% -%% This package consists of the file xeCJK.dtx +%% This package consists of the file xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, %% and the derived files xeCJK.pdf, %% xeCJK.sty, %% xeCJK.cfg, %% xeCJK.ins, %% xeCJKfntef.sty, %% xeCJK-listings.sty, +%% xunicode-addon.sty, %% xeCJK-example-autofake.tex, %% xeCJK-example-fallback.tex, %% xeCJK-example-subCJKblock.tex, @@ -3460,7 +3567,11 @@ %% xeCJK-example-punctstyle.tex, %% xeCJK-example-verbatim.tex, %% xeCJK-example-IVS.tex, -%% xeCJK-example-listings.tex, and +%% xeCJK-example-listings.tex, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and %% README.txt. %% %% End of file `xeCJK.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty b/Master/texmf-dist/tex/xelatex/xecjk/xeCJKfntef.sty index dc3fda86212..13dd0469dd6 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 465 2013-07-06 10:30:24Z sobenlee $ +%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z 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 465 2013-07-06 10:30:24Z sobenlee $ +\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ {xeCJK patch file for ulem/CJKfntef} \ProvidesExplPackage {xeCJKfntef} - {\ExplFileDate}{3.2.4}{\ExplFileDescription} + {\ExplFileDate}{3.2.5}{\ExplFileDescription} \PassOptionsToPackage { normalem } { ulem } \DeclareOption* { \PassOptionsToPackage { \CurrentOption } { ulem } } \ProcessOptions \scan_stop: @@ -100,6 +100,7 @@ \xeCJK_FullRight_and_CJK: \__xeCJK_ulem_FullRight_and_CJK: \xeCJK_CJK_and_CJK:N \__xeCJK_ulem_CJK_and_CJK:N \xeCJK_Boundary_and_Default: \__xeCJK_ulem_Boundary_and_Default: + \xeCJK_Boundary_and_NormalSp: \__xeCJK_ulem_Boundary_and_NormalSp: \xeCJK@fix@penalty \__xeCJK_ulem_fix_penalty: \__xeCJK_punct_hskip:n \__xeCJK_ulem_punct_hskip:n \__xeCJK_CJK_and_Boundary_aux: \__xeCJK_ulem_CJK_and_Boundary_aux: @@ -151,6 +152,12 @@ } { \__xeCJK_ulem_Boundary_and_Default: } } +\cs_new_protected_nopar:Npn \__xeCJK_ulem_Boundary_and_NormalSp: + { + \xeCJK_if_ulem_patch:TF + { \xeCJK_if_last_node:nT { CJK-space } { \xeCJK_remove_node: \c_space_tl } } + { \__xeCJK_ulem_Boundary_and_NormalSp: } + } \cs_new_protected_nopar:Npn \__xeCJK_ulem_CJK_and_Boundary_aux: { \xeCJK_if_ulem_patch:TF @@ -453,13 +460,18 @@ } [ \ignorespacesafterend ] %% -%% This package consists of the file xeCJK.dtx +%% This package consists of the file xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, %% and the derived files xeCJK.pdf, %% xeCJK.sty, %% xeCJK.cfg, %% xeCJK.ins, %% xeCJKfntef.sty, %% xeCJK-listings.sty, +%% xunicode-addon.sty, %% xeCJK-example-autofake.tex, %% xeCJK-example-fallback.tex, %% xeCJK-example-subCJKblock.tex, @@ -469,7 +481,11 @@ %% xeCJK-example-punctstyle.tex, %% xeCJK-example-verbatim.tex, %% xeCJK-example-IVS.tex, -%% xeCJK-example-listings.tex, and +%% xeCJK-example-listings.tex, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and %% README.txt. %% %% End of file `xeCJKfntef.sty'. diff --git a/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty new file mode 100644 index 00000000000..d013fea26d2 --- /dev/null +++ b/Master/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty @@ -0,0 +1,326 @@ +%% +%% This is file `xunicode-addon.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xeCJK.dtx (with options: `xunicode') +%% +%% $Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ +%% $URL: https://ctex-kit.googlecode.com/svn/trunk/xeCJK/xeCJK.dtx $ +%% ----------------------------------------------------------------- +%% Author: +%% Wenchang Sun +%% Current Maintainers: +%% Leo Liu +%% Qing Lee +%% +%% Copyright (C) 2007--2013 Wenchang Sun +%% (C) 2009--2013 Leo Liu +%% (C) 2012--2013 Qing Lee +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% The Current Maintainer of this work are Leo Liu and Qing Lee. +%% ----------------------------------------------------------------- +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: xeCJK.dtx 477 2013-07-25 22:15:20Z sobenlee $ + {addon file for xunicode} +\ProvidesExplPackage + {xunicode-addon} + {\ExplFileDate}{3.2.5}{\ExplFileDescription} +\pdftex_if_engine:T + { + \msg_new:nnnn { xunicode-addon } { cannot-use-pdftex } + { This~package~requires~either~XeTeX~or~LuaTeX~to~function.} + { + You~must~change~your~typesetting~engine~to,~e.g.,\\ + "xelatex"~or~"lualatex"~instead~of~plain~"latex"~or~"pdflatex". + } + \msg_critical:nn { xunicode-addon } { cannot-use-pdftex } + } +\RequirePackage { xparse } +\clist_new:N \g__xunadd_encname_clist +\DeclareOption* + { \clist_gput_left:NV \g__xunadd_encname_clist \CurrentOption } +\ProcessOptions \scan_stop: +\tl_if_exist:NT \UTFencname + { \clist_gput_left:Nx \g__xunadd_encname_clist { \UTFencname } } +\@ifpackageloaded { xunicode } { } + { + \clist_get:NNF \g__xunadd_encname_clist \UTFencname + { + \xetex_if_engine:TF + { \tl_set:Nn \UTFencname { EU1 } } + { \tl_set:Nn \UTFencname { EU2 } } + \clist_set_eq:NN \g__xunadd_encname_clist \UTFencname + } + \xetex_if_engine:TF + { \RequirePackage { xunicode } } + { + \cs_set_eq:NN \__xunadd_tmp:w \XeTeXpicfile + \cs_set_eq:NN \XeTeXpicfile \prg_do_nothing: + \RequirePackage { xunicode } + \cs_set_eq:NN \XeTeXpicfile \__xunadd_tmp:w + } + } +\AtEndOfPackage { \ReloadXunicode { \g__xunadd_encname_clist } } +\RenewDocumentCommand \ReloadXunicode { m } + { + \clist_set:Nx \l__xunadd_encname_clist {#1} + \clist_remove_duplicates:N \l__xunadd_encname_clist + \use:x + { + \bool_if:NT \l__kernel_expl_bool { \ExplSyntaxOff } + \char_set_catcode_letter:n { 64 } + \__xunadd_reload:N \exp_not:N \l__xunadd_encname_clist + \char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } } + \bool_if:NT \l__kernel_expl_bool { \ExplSyntaxOn } + } + } +\cs_new_protected:Npn \__xunadd_reload:N #1 + { + \cs_set_eq:NN \__xunadd_tmp:w \iftipaonetoken + \cs_set_eq:NN \iftipaonetoken \scan_stop: + \clist_map_inline:Nn #1 + { + \cs_if_exist:cTF { T@ ##1 } + { + \tl_set:Nx \UTFencname {##1} + \clist_gput_right:Nx \g__xunadd_encname_clist {##1} + \file_input:n { xunicode.sty } + } + { \msg_error:nnn { xunicode-addon } { encoding-unknown } {##1} } + } + \cs_set_eq:NN \iftipaonetoken \__xunadd_tmp:w + \clist_gremove_duplicates:N \g__xunadd_encname_clist + } +\clist_new:N \l__xunadd_encname_clist +\msg_new:nnnn { xunicode-addon } { encoding-unknown } + {Encoding~scheme~"#1"~unknown.} + { + You~may~use \\\\ + \token_to_str:N \usepackage [ #1 , \encodingdefault ] {fontenc} \\\\ + before~xunicode-addon~or~xunicode. + } +\prg_new_conditional:Npnn \__xunadd_glyph_if_exist:n #1 { p , T , F , TF } + { + \etex_iffontchar:D \tex_font:D \etex_numexpr:D #1 \scan_stop: + \prg_return_true: \else: \prg_return_false: \fi: + } +\RenewDocumentCommand \UndeclareUTFcharacter { O { \UTFencname } m m } + { + \__xunadd_if_csname:nTF {#3} + { \UndeclareTextCommand {#3} } + { \exp_args:Nc \UndeclareTextCommand { \tl_to_str:n {#3} } } + {#1} + } +\RenewDocumentCommand \UndeclareUTFcomposite { O { \UTFencname } m m m } + { + \__xunadd_if_csname:nTF {#3} + { \__xunadd_undeclare_composite:Nnnn #3 } + { \exp_args:Nc \__xunadd_undeclare_composite:Nnnn { \tl_to_str:n {#3} } } + {#1} {#4} {#2} + } +\cs_new_protected:Npn \__xunadd_undeclare_composite:Nnnn #1#2#3#4 + { \cs_undefine:c { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } } +\prg_new_conditional:Npnn \__xunadd_if_csname:n #1 { TF } + { + \tl_if_single_token:nTF {#1} + { + \if_predicate:w + \bool_if_p:n { \token_if_cs_p:N #1 || \token_if_active_p:N #1 } + \prg_return_true: \else: \prg_return_false: \fi: + } + { \prg_return_false: } + } +\RenewDocumentCommand \DeclareUTFcharacter { O { \UTFencname } m m } + { + \__xunadd_if_csname:nTF {#3} + { \__xunadd_declare_character:Nnn #3 } + { \exp_args:Nc \__xunadd_declare_character:Nnn { \tl_to_str:n {#3} } } + {#1} {#2} + } +\cs_new_protected:Npn \__xunadd_declare_character:Nnn #1#2#3 + { + \__xunadd_provide_text_command_default:N #1 + \group_begin: + \char_set_lccode:nn { `0 } { \__xunadd_check_slot:n {#3} } + \tl_to_lowercase:n + { + \group_end: + \__xunadd_declare_character:NNxn 0 + } + #1 { \token_to_str:N #1 } {#2} + } +\cs_new_protected:Npn \__xunadd_provide_text_command_default:N #1 + { + \bool_if:nF + { + \cs_if_exist_p:c { ? \token_to_str:N #1 } || + \cs_if_free_p:c { ? - \token_to_str:N #1 } + } + { \exp_args:NNv \ProvideTextCommandDefault #1 { ? - \token_to_str:N #1 } } + } +\cs_new_protected:Npn \__xunadd_declare_character:NNnn #1#2#3#4 + { \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_glyph_if_exist:nTF { `#2 } + {#2} { \cs_if_exist_use:cF { ? #1 } {#2} } + \tl_use:N \l__xunadd_end_hook_tl + } +\cs_generate_variant:Nn \__xunadd_declare_character:NNnn { NNx } +\cs_new_nopar:Npn \__xunadd_check_slot:n #1 + { + \int_eval:n + { + \tl_if_head_eq_charcode:nNTF {#1} x + { " \use_none:n #1 } {#1} + } + } +\RenewDocumentCommand \DeclareUTFcomposite { O { \UTFencname } m m m } + { + \__xunadd_if_csname:nTF {#3} + { \__xunadd_declare_composite:Nnnn #3 } + { \exp_args:Nc \__xunadd_declare_composite:Nnnn { \tl_to_str:n {#3} } } + {#1} {#4} {#2} + } +\cs_new_protected:Npn \__xunadd_declare_composite:Nnnn #1#2#3#4 + { + \tex_afterassignment:D \use_none_delimit_by_q_stop:w + \__xunadd_chardef:cn + { \token_to_str:c {#2} \token_to_str:N #1 - \tl_to_str:n {#3} } + { \__xunadd_check_slot:n {#4} } + \q_stop + } +\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 } +\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} } } + {#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} } } + {#1} {#4} {#3} + } +\cs_new_protected:Npn \__xunadd_declare_accent:Nnnn #1#2#3#4 + { + \group_begin: + \char_set_lccode:nn { `3 } { "#3 } + \char_set_lccode:nn { `4 } { \tl_if_blank:nTF {#4} { "#3 } { "#4 } } + \tl_to_lowercase:n + { + \group_end: + \__xunadd_declare_accent:NNNxxn 3 4 + } + #1 { \token_to_str:c {#2} } { \token_to_str:N #1 } {#2} + } +\cs_new_protected:Npn \__xunadd_declare_accent:NNNnnn #1#2#3#4#5#6 + { + \DeclareTextCommand #3 {#6} + { \__xunadd_text_composite:nnNNn {#4} {#5} {#1} {#2} } + } +\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 + \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_add_accent:nnNN {#5} {#2} #3#4 } + \tl_use:N \l__xunadd_end_hook_tl + } +\cs_generate_variant:Nn \token_if_chardef:NTF { c } +\cs_new_protected:Npn \__xunadd_add_accent:nnNN #1#2#3#4 + { + \tl_if_blank:nTF {#1} + { + \__xunadd_glyph_if_exist:nTF { `#4 } + {#4} + { + \cs_if_exist_use:cTF { ? #2 } + { {#1} } {#4} + } + } + { + \__xunadd_glyph_if_exist:nTF { `#3 } + { #1#3 } + { + \__xunadd_glyph_if_exist:nTF { `#4 } + { \add@accent { `#4 } {#1} } + { + \cs_if_exist_use:cTF { ? #2 } + { {#1} } {#1} + } + } + } + } +\NewDocumentCommand \AtBeginUTFCommand { s +m } + { + \IfBooleanTF {#1} + { \tl_set:Nn \l__xunadd_begin_hook_tl {#2} } + { \tl_put_right:Nn \l__xunadd_begin_hook_tl {#2} } + } +\NewDocumentCommand \AtEndUTFCommand { s +m } + { + \IfBooleanTF {#1} + { \tl_set:Nn \l__xunadd_end_hook_tl {#2} } + { \tl_put_right:Nn \l__xunadd_end_hook_tl {#2} } + } +\tl_new:N \l__xunadd_begin_hook_tl +\tl_new:N \l__xunadd_end_hook_tl +%% +%% This package consists of the file xeCJK.dtx, +%% full-stop.map, +%% fullwidth-stop.map, +%% han-simp.map, +%% han-trad.map, +%% and the derived files xeCJK.pdf, +%% xeCJK.sty, +%% xeCJK.cfg, +%% xeCJK.ins, +%% xeCJKfntef.sty, +%% xeCJK-listings.sty, +%% xunicode-addon.sty, +%% xeCJK-example-autofake.tex, +%% xeCJK-example-fallback.tex, +%% xeCJK-example-subCJKblock.tex, +%% xeCJK-example-CJKecglue.tex, +%% xeCJK-example-checksingle.tex, +%% xeCJK-example-CJKfntef.tex, +%% xeCJK-example-punctstyle.tex, +%% xeCJK-example-verbatim.tex, +%% xeCJK-example-IVS.tex, +%% xeCJK-example-listings.tex, +%% full-stop.tec, +%% fullwidth-stop.tec, +%% han-simp.tec, +%% han-trad.tec, and +%% README.txt. +%% +%% End of file `xunicode-addon.sty'. -- cgit v1.2.3