diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty b/Master/texmf-dist/tex/latex/xpinyin/xpinyin.sty index ef216f8fa1e..c0f2eb0c7dd 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 700 2014-06-25 10:54:28Z sobenlee $ +\GetIdInfo$Id: xpinyin.dtx 746 2014-12-23 13:58:49Z sobenlee@gmail.com $ {Automatically add pinyin to Chinese characters} \ProvidesExplPackage{\ExplFileName} - {\ExplFileDate}{1.9}{\ExplFileDescription} + {\ExplFileDate}{2.0}{\ExplFileDescription} \msg_new:nnn { xpinyin } { no-LuaTeX } { The~xpinyin~package~is~not~supported~in~LuaTeX.\\\\ @@ -32,21 +32,26 @@ "xelatex"~or~"pdflatex"~or~"latex"~instead~of~"lualatex". } \luatex_if_engine:T { \msg_critical:nn { xpinyin } { no-LuaTeX } } -\RequirePackage{xparse} -\RequirePackage{l3keys2e} +\RequirePackage { xparse } +\RequirePackage { l3keys2e } \prop_new:N \c__xpinyin_tone_prop \clist_map_inline:nn { - { ā }{ \= a } , { á }{ \' a } , { ǎ }{ \v a } , { à }{ \` a } , - { ō }{ \= o } , { ó }{ \' o } , { ǒ }{ \v o } , { ò }{ \` o } , - { ē }{ \= e } , { é }{ \' e } , { ě }{ \v e } , { è }{ \` e } , - { ū }{ \= u } , { ú }{ \' u } , { ǔ }{ \v u } , { ù }{ \` u } , - { ḿ }{ \' m } , { ń }{ \' n } , { ň }{ \v n } , { ǹ }{ \` n } , - { ī }{ \= { \i } } , { í }{ \' { \i } } , - { ǐ }{ \v { \i } } , { ì }{ \` { \i } } , + { ā }{ \@tabacckludge= a } , { á }{ \@tabacckludge' a } , + { ǎ }{ \v a } , { à }{ \@tabacckludge` a } , + { ō }{ \@tabacckludge= o } , { ó }{ \@tabacckludge' o } , + { ǒ }{ \v o } , { ò }{ \@tabacckludge` o } , + { ē }{ \@tabacckludge= e } , { é }{ \@tabacckludge' e } , + { ě }{ \v e } , { è }{ \@tabacckludge` e } , + { ū }{ \@tabacckludge= u } , { ú }{ \@tabacckludge' u } , + { ǔ }{ \v u } , { ù }{ \@tabacckludge` u } , + { ḿ }{ \@tabacckludge' m } , { ń }{ \@tabacckludge' n } , + { ň }{ \v n } , { ǹ }{ \@tabacckludge` n } , + { ī }{ \@tabacckludge= { \i } } , { í }{ \@tabacckludge' { \i } } , + { ǐ }{ \v { \i } } , { ì }{ \@tabacckludge` { \i } } , { ü }{ \" u } , - { ǖ }{ \= { \" u } } , { ǘ }{ \' { \" u } } , - { ǚ }{ \v { \" u } } , { ǜ }{ \` { \" u } } + { ǖ }{ \@tabacckludge= { \" u } } , { ǘ }{ \@tabacckludge' { \" u } } , + { ǚ }{ \v { \" u } } , { ǜ }{ \@tabacckludge` { \" u } } } { \prop_gput:Nnn \c__xpinyin_tone_prop #1 } \cs_new_protected_nopar:Npn \__xpinyin_UTF_char:nn #1#2 @@ -145,6 +150,16 @@ \hbox_set:Nn \l__xpinyin_tmpa_box {#2} #1 = \box_wd:N \l__xpinyin_tmpa_box } +\cs_if_exist:NTF \quitvmode + { \cs_new_eq:NN \__xpinyin_quit_vmode: \quitvmode } + { + \cs_new_protected_nopar:Npn \__xpinyin_quit_vmode: + { + \if_mode_vertical: + \exp_after:wN \tex_indent:D + \fi: + } + } \cs_new_protected_nopar:Npn \__xpinyin_make_pinyin_box:nnn #1#2#3 { \__xpinyin_leavevmode: @@ -214,7 +229,7 @@ \keys_set:nn { xpinyin } {#2} \bool_if:NF \l__xpinyin_enable_bool { \__xpinyin_width:Nn \l__xpinyin_CJKglue_dim { \CJKglue } } - \leavevmode + \__xpinyin_quit_vmode: \__xpinyin_single_aux:nn {#3} } } @@ -306,14 +321,14 @@ \selectfont } \cs_new_nopar:Npn \__xpinyin_to_unicode_xetex:n #1 - { \int_to_Hex:n { `#1 } } + { \int_to_arabic:n { `#1 } } \cs_new_nopar:Npn \__xpinyin_UTF_to_unicode:n #1 { - \int_to_Hex:n + \int_to_arabic:n { \exp_args:No \int_from_hex:n { \CJK@plane } * "100 + #1 } } \cs_new_nopar:Npn \__xpinyin_UTFchar_to_unicode:n #1 - { \int_to_Hex:n { \__xpinyin_UTF_viii_to_unicode:NNNw #1 \q_stop } } + { \int_to_arabic:n { \__xpinyin_UTF_viii_to_unicode:NNNw #1 \q_stop } } \cs_new_nopar:Npn \__xpinyin_UTF_viii_to_unicode:NNNw #1#2#3#4 \q_stop { \tl_if_empty:nTF {#4} @@ -321,9 +336,9 @@ { ( `#1 - "F0 ) * "4000 + ( `#2 - "80 ) * "1000 + ( `#3 - "80 ) * "40 + ( `#4 - "80 ) } } \cs_new_nopar:Npn \__xpinyin_GBK_to_unicode:n #1 - { \CJKtu_sfd_map:nn { \CJK@plane } {#1} } + { \int_to_arabic:n { " \CJKtu_sfd_map:nn { \CJK@plane } {#1} } } \cs_new_nopar:Npn \__xpinyin_GBKchar_to_unicode:n #1 - { \CJKchartouni {#1} } + { \int_to_arabic:n { " \CJKchartouni {#1} } } \cs_new_protected_nopar:Npn \__xpinyin_adjust_xeCJK_hook: { \cs_new_eq:NN \__xpinyin_select_font: \__xpinyin_select_font_xetex: @@ -368,7 +383,7 @@ \cs_new_eq:NN \__xpinyin_char_to_unicode:n \__xpinyin_UTFchar_to_unicode:n } \cs_new_eq:NN \__xpinyin_select_font: \__xpinyin_select_font_aux: - \cs_new_eq:NN \__xpinyin_leavevmode: \leavevmode + \cs_new_eq:NN \__xpinyin_leavevmode: \__xpinyin_quit_vmode: \cs_new_eq:NN \__xpinyin_CJKsymbol_hook: \prg_do_nothing: \@ifpackageloaded { CJKpunct } { \__xpinyin_adjust_CJKpunct_hook: } |