From a75a0391a6a6873345d5d864a61031eb4dd09780 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 23 Nov 2012 22:45:59 +0000 Subject: xpinyin (23nov12) git-svn-id: svn://tug.org/texlive/trunk@28346 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty | 54 +++++++++++++------------ 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'Master/texmf-dist/tex/latex/xpinyin') diff --git a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty index 88e45cf4a19..c9740575b02 100644 --- a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty +++ b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty @@ -21,9 +21,9 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: xpinyin.dtx 351 2012-07-20 05:30:58Z sobenlee $ - {package for automatically add pinyin to Chinese characters} -\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{1.1}{\ExplFileDescription} +\GetIdInfo$Id: xpinyin.dtx 367 2012-11-23 04:45:50Z sobenlee $ + {Automatically add pinyin to Chinese characters} +\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{1.2}{\ExplFileDescription} \msg_new:nnn { xpinyin } { no-LuaTeX } { The~xpinyin~package~is~not~supported~in~LuaTeX.\\\\ @@ -59,8 +59,8 @@ { \box_wd:N \l_xpinyin_tmpa_box + \l_xpinyin_CJKglue_dim } { \box_resize:Nnn \l_xpinyin_tmpb_box - { \dim_eval:n { \box_wd:N \l_xpinyin_tmpa_box + \l_xpinyin_CJKglue_dim } } - { \dim_eval:n { \box_ht:N \l_xpinyin_tmpb_box + \box_dp:N \l_xpinyin_tmpb_box } } + { \box_wd:N \l_xpinyin_tmpa_box + \l_xpinyin_CJKglue_dim } + { \box_ht:N \l_xpinyin_tmpb_box + \box_dp:N \l_xpinyin_tmpb_box } } \box_move_up:nn { \l_xpinyin_vsep_tl } { @@ -144,8 +144,9 @@ } \cs_new_nopar:Nn \xpinyin_select_font_aux: { - \dim_set:Nn \l_tmpa_dim { \f@size \p@ } - \fontsize { \l_xpinyin_ratio_tl \l_tmpa_dim } \c_zero_dim + \fontsize + { \l_xpinyin_ratio_tl \etex_dimexpr:D \f@size pt \scan_stop: } + { \c_zero_skip } \l_xpinyin_font_tl \selectfont } @@ -168,11 +169,10 @@ \cs_new_eq:NN \xpinyin_CJKchar_to_unicode:n \xpinyin_CJKsymbol_to_unicode:n \cs_new_eq:NN \xpinyin_replace_CJKsymbol: \xpinyin_replace_CJKsymbol_aux: \cs_new_eq:NN \xpinyin_CJK_node: \xeCJK_CJK_kern: - \cs_new_eq:NN \xpinyin_CJK_ignorespaces: \xeCJK_ignorespaces: - \cs_if_exist:NF \xpinyin_CJK_node: - { \cs_new_nopar:Npn \xpinyin_CJK_node: { \xeCJK_make_node:n { CJK } } } + \cs_new_eq:NN \xpinyin_CJK_ignorespaces: \xeCJK_ignore_spaces:w + \cs_new_protected_nopar:Npn \xpinyin_CJK_node: { \xeCJK_make_node:n { CJK } } \tl_gset:Nn \l_xpinyin_coor_tl - { (\cs_meaning:N \l_xpinyin_font_tl)/\l_xeCJK_font_coor_tl/\l_xpinyin_ratio_tl } + { (\cs_meaning:N \l_xpinyin_font_tl)/\l_xeCJK_current_font_tl/\l_xpinyin_ratio_tl } \cs_new_nopar:Nn \xpinyin_CJKsymbol_hook: { \makexeCJKinactive \xeCJK_select_font: } \cs_new_nopar:Npn \xpinyin_xpinyin_single_hook:n { \cs_if_eq:NNTF \CJKsymbol \xpinyin_CJKsymbol:n { \cs_set_eq:NN \CJKsymbol \use:n } } @@ -258,29 +258,29 @@ \quark_if_recursion_tail_stop_do:Nn #1 { \bool_if:NTF \l_xpinyin_first_bool { \l_xpinyin_save_tl } - { \tl_if_empty:NF \l_tmpc_tl { \l_xpinyin_pysep_tl \l_tmpc_tl } } + { \tl_if_empty:NF \l_xpinyin_item_tl { \l_xpinyin_pysep_tl \l_xpinyin_item_tl } } } \xpinyin_if_number:NTF {#1} { \bool_if:NTF \l_xpinyin_first_bool { \bool_set_false:N \l_xpinyin_first_bool } { \l_xpinyin_pysep_tl } - \l_tmpa_tl + \l_xpinyin_pre_tl \xpinyin_tone:Vn \l_xpinyin_tone_tl {#1} - \l_tmpb_tl + \l_xpinyin_post_tl \xpinyin_xpinyin_init: } { \int_compare:nNnTF - { 0 \use:c { c_xpinyin_ \tl_to_str:V \l_xpinyin_tone_tl _tl } } > - { 0 \use:c { c_xpinyin_ \tl_to_str:n {#1} _tl } } - { \tl_put_right:Nn \l_tmpb_tl {#1} } + { 0 \cs_if_exist_use:c { c_xpinyin_ \tl_to_str:V \l_xpinyin_tone_tl _tl } } > + { 0 \cs_if_exist_use:c { c_xpinyin_ \tl_to_str:n {#1} _tl } } + { \tl_put_right:Nn \l_xpinyin_post_tl {#1} } { \tl_set:Nn \l_xpinyin_tone_tl {#1} - \tl_set_eq:NN \l_tmpa_tl \l_tmpc_tl - \tl_clear:N \l_tmpb_tl + \tl_set_eq:NN \l_xpinyin_pre_tl \l_xpinyin_item_tl + \tl_clear:N \l_xpinyin_post_tl } - \tl_put_right:Nx \l_tmpc_tl { \xpinyin_replace_v:N {#1} } + \tl_put_right:Nx \l_xpinyin_item_tl { \xpinyin_replace_v:N {#1} } } \xpinyin_xpinyin_aux:N } @@ -293,15 +293,18 @@ \str_if_eq:nnTF {#1} { v } { \bool_if:nTF - { \str_if_eq_p:Vn \l_tmpc_tl { l } || \str_if_eq_p:Vn \l_tmpc_tl { n } } + { + \str_if_eq_p:Vn \l_xpinyin_item_tl { l } || + \str_if_eq_p:Vn \l_xpinyin_item_tl { n } + } { \exp_not:n { ΓΌ} } { u } } { \exp_not:n {#1} } } \cs_new_nopar:Nn \xpinyin_xpinyin_init: { - \tl_clear:N \l_tmpa_tl \tl_clear:N \l_tmpb_tl - \tl_clear:N \l_tmpc_tl \tl_clear:N \l_xpinyin_tone_tl + \tl_clear:N \l_xpinyin_pre_tl \tl_clear:N \l_xpinyin_post_tl + \tl_clear:N \l_xpinyin_item_tl \tl_clear:N \l_xpinyin_tone_tl } \prg_new_conditional:Nnn \xpinyin_if_number:N { p , T , F , TF } { @@ -338,8 +341,7 @@ { \xpinyin_num_to_tone:Nn u {#2} } } \prop_new:N \g_xpinyin_tone_prop -\cs_new_nopar:Nn \xpinyin_prop_put_aux:n { \prop_gput:Nnn \g_xpinyin_tone_prop #1 } -\clist_map_function:nN +\clist_map_inline:nn { {0101}{\=a} , {00E1}{\'a} , {01CE}{\v{a}} , {00E0}{\`a} , {014D}{\=o} , {00F3}{\'o} , {01D2}{\v{o}} , {00F2}{\`o} , @@ -349,7 +351,7 @@ {00FC}{\"u} , {01D6}{\={\"u}} , {01D8}{\'{\"u}} , {01DA}{\v{\"u}} , {01DC}{\`{\"u}} } - \xpinyin_prop_put_aux:n + { \prop_gput:Nnn \g_xpinyin_tone_prop #1 } \NewDocumentCommand \xpinyinsetup { m } { \keys_set:nn { xpinyin } {#1} } \clist_map_inline:nn { ratio , vsep , hsep , pysep , font , format , multiple } -- cgit v1.2.3