diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty index cd488147b72..0d75f6be182 100644 --- a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty +++ b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty @@ -21,10 +21,10 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xpinyin.dtx 526 2013-11-12 00:16:04Z sobenlee $ +\GetIdInfo$Id: xpinyin.dtx 539 2014-01-04 08:07:32Z sobenlee $ {Automatically add pinyin to Chinese characters} \ProvidesExplPackage{\ExplFileName} - {\ExplFileDate}{1.5}{\ExplFileDescription} + {\ExplFileDate}{1.6}{\ExplFileDescription} \msg_new:nnn { xpinyin } { no-LuaTeX } { The~xpinyin~package~is~not~supported~in~LuaTeX.\\\\ @@ -220,12 +220,22 @@ \dim_new:N \l__xpinyin_CJKglue_dim \cs_new_protected_nopar:Npn \__xpinyin_single_aux:nn #1#2 { - \__xpinyin_single_hook:n - { \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \use:n } - \cs_set_eq:NN \__xpinyin_to_unicode:n \__xpinyin_char_to_unicode:n - \__xpinyin_make_box:nn {#1} { \__xpinyin_pinyin:n {#2} } + \__xpinyin_single_hook:n { \__xpinyin_replace_CJKsymbol: } + \__xpinyin_replace_CJKsymbol_single:n {#2} + #1 \group_end: } +\cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol_single_aux:n #1 + { + \cs_set_protected_nopar:Npn \CJKsymbol ##1 + { \__xpinyin_single_CJKsymbol:nn {##1} {#1} } + } +\cs_new_protected_nopar:Npn \__xpinyin_single_CJKsymbol:nn #1#2 + { + \__xpinyin_make_pinyin_box:nnn + { \__xpinyin_to_unicode:n {#1} } {#1} { \__xpinyin_pinyin:n {#2} } + \__xpinyin_save_CJKsymbol:n {#1} + } \cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol_aux: { \cs_if_eq:NNF \CJKsymbol \__xpinyin_CJKsymbol:n @@ -235,13 +245,7 @@ } } \cs_new_protected_nopar:Npn \__xpinyin_single_hook_aux:n - { - \cs_if_eq:NNTF \CJKsymbol \__xpinyin_CJKsymbol:n - { - \cs_set_eq:NN \CJKsymbol \__xpinyin_save_CJKsymbol:n - \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \use:n - } - } + { \cs_if_eq:NNF \CJKsymbol \__xpinyin_CJKsymbol:n } \cs_new_protected_nopar:Npn \__xpinyin_select_font_xetex: { \cs_if_exist_use:cF { \l__xpinyin_coor_tl } @@ -288,13 +292,15 @@ \cs_new_eq:NN \__xpinyin_to_unicode:n \__xpinyin_to_unicode_xetex:n \cs_new_eq:NN \__xpinyin_char_to_unicode:n \__xpinyin_to_unicode:n \cs_new_eq:NN \__xpinyin_replace_CJKsymbol: \__xpinyin_replace_CJKsymbol_aux: + \cs_new_eq:NN \__xpinyin_replace_CJKsymbol_single:n + \__xpinyin_replace_CJKsymbol_single_aux:n \tl_gset:Nn \l__xpinyin_coor_tl { (\cs_meaning:N \l__xpinyin_font_tl)/\l_xeCJK_current_font_tl/\l__xpinyin_ratio_tl } \cs_new_eq:NN \__xpinyin_leavevmode: \prg_do_nothing: \cs_new_protected_nopar:Npn \__xpinyin_CJKsymbol_hook: { \makexeCJKinactive \xeCJK_select_font: } \cs_new_protected_nopar:Npn \__xpinyin_single_hook:n - { \cs_if_eq:NNTF \CJKsymbol \__xpinyin_CJKsymbol:n { \cs_set_eq:NN \CJKsymbol \use:n } } + { \cs_if_eq:NNF \CJKsymbol \__xpinyin_CJKsymbol:n } } \cs_new_protected_nopar:Npn \__xpinyin_adjust_CJK_hook: { @@ -315,12 +321,15 @@ { \cs_new_eq:NN \__xpinyin_single_hook:n \__xpinyin_single_hook_aux:n \cs_new_eq:NN \__xpinyin_replace_CJKsymbol: \__xpinyin_replace_CJKsymbol_aux: + \cs_new_eq:NN \__xpinyin_replace_CJKsymbol_single:n + \__xpinyin_replace_CJKsymbol_single_aux:n \AtBeginDocument { \@ifpackageloaded { CJKpunct } { \cs_undefine:N \__xpinyin_single_hook:n \cs_undefine:N \__xpinyin_replace_CJKsymbol: + \cs_undefine:N \__xpinyin_replace_CJKsymbol_single:n \__xpinyin_adjust_CJKpunct_hook: } { } } @@ -340,18 +349,21 @@ } } } - \cs_new_protected_nopar:Npn \__xpinyin_single_hook:n + \cs_new_protected_nopar:Npn \__xpinyin_replace_CJKsymbol_single:n ##1 { \int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain } - { \__xpinyin_single_hook_aux:n } + { \__xpinyin_replace_CJKsymbol_single_aux:n {##1} } { - \cs_if_eq:NNTF \CJKosymbol \__xpinyin_CJKsymbol:n - { - \cs_set_eq:NN \CJKosymbol \__xpinyin_save_CJKsymbol:n - \cs_set_eq:NN \__xpinyin_save_CJKsymbol:n \use:n - } + \cs_set_protected_nopar:Npn \CJKosymbol ####1 + { \__xpinyin_single_CJKsymbol:nn {####1} {##1} } } } + \cs_new_protected_nopar:Npn \__xpinyin_single_hook:n + { + \int_compare:nNnTF { \CJKpunct@punctstyle } = { \CJKpunct@ps@plain } + { \__xpinyin_single_hook_aux:n } + { \cs_if_eq:NNF \CJKosymbol \__xpinyin_CJKsymbol:n } + } } \NewDocumentCommand \pinyin { O { } m } { |