diff options
Diffstat (limited to 'Master/texmf-dist/tex')
4 files changed, 616 insertions, 300 deletions
diff --git a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg new file mode 100644 index 00000000000..77e0aa94e1c --- /dev/null +++ b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-big5.cfg @@ -0,0 +1,91 @@ +%% +%% This is file `zhnumber-big5.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% zhnumber.dtx (with options: `config,big5') +%% +%% Copyright (C) 2012 by Qing Lee <sobenlee@gmail.com> +%% -------------------------------------------------------------------------- +%% This work 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 is Qing Lee. +%% +\GetIdInfo$Id: zhnumber.dtx 351 2012-07-20 05:30:58Z sobenlee $ + {Chinese numerals with Big5 encoding} +\ProvidesExplFile + {\ExplFileName-big5.cfg} + {\ExplFileDate} {1.6} {\ExplFileDescription} +\zhnum_set_digits_map:nn { minus } { 負 } +\zhnum_set_digits_map:nn { zero } { 零 } +\zhnum_set_digits_map:nn { null } { ○ } +\zhnum_set_digits_map:nn { one } { 一 } +\zhnum_set_digits_map:nn { two } { 二 } +\zhnum_set_digits_map:nn { three } { 三 } +\zhnum_set_digits_map:nn { four } { 四 } +\zhnum_set_digits_map:nn { five } { 五 } +\zhnum_set_digits_map:nn { six } { 六 } +\zhnum_set_digits_map:nn { seven } { 七 } +\zhnum_set_digits_map:nn { eight } { 八 } +\zhnum_set_digits_map:nn { nine } { 九 } +\zhnum_set_digits_map:nn { ten } { 十 } +\zhnum_set_digits_map:nn { hundred } { 百 } +\zhnum_set_digits_map:nn { thousand } { 千 } +\zhnum_set_digits_map:nn { twenty } { 廿 } +\zhnum_set_digits_map:nn { thirty } { 卅 } +\zhnum_set_digits_map:nn { forty } { 卌 } +\zhnum_set_digits_map:nn { two_hundred } { 皕 } +\zhnum_set_digits_map:nn { dot } { 點 } +\zhnum_set_digits_map:nn { and } { 又 } +\zhnum_set_digits_map:nn { parts } { 分之 } +\zhnum_set_digits_map:nn { scale_zero } { } +\zhnum_set_digits_map:nn { scale_one } { 萬 } +\zhnum_set_digits_map:nn { scale_two } { 億 } +\zhnum_set_digits_map:nn { scale_three } { 兆 } +\zhnum_set_digits_map:nn { scale_four } { 京 } +\zhnum_set_digits_map:nn { scale_five } { 垓 } +\zhnum_set_digits_map:nn { scale_six } { 秭 } +\zhnum_set_digits_map:nn { scale_seven } { 穰 } +\zhnum_set_digits_map:nn { scale_eight } { 澗 } +\zhnum_set_digits_map:nn { scale_ten } { 正 } +\zhnum_set_digits_map:nn { scale_eleven } { 載 } +\zhnum_set_digits_map:nn { year } { 年 } +\zhnum_set_digits_map:nn { month } { 月 } +\zhnum_set_digits_map:nn { day } { 日 } +\zhnum_set_digits_map:nn { hour } { 時 } +\zhnum_set_digits_map:nn { minute } { 分 } +\zhnum_set_digits_map:nn { weekday } { 星期 } +\zhnum_set_financial_map:nn { null } { 零 } +\zhnum_set_financial_map:nn { zero } { 零 } +\zhnum_set_financial_map:nn { one } { 壹 } +\zhnum_set_financial_map:nn { two } { 貳 } +\zhnum_set_financial_map:nn { three } { 參 } +\zhnum_set_financial_map:nn { four } { 肆 } +\zhnum_set_financial_map:nn { five } { 伍 } +\zhnum_set_financial_map:nn { six } { 陸 } +\zhnum_set_financial_map:nn { seven } { 柒 } +\zhnum_set_financial_map:nn { eight } { 捌 } +\zhnum_set_financial_map:nn { nine } { 玖 } +\zhnum_set_financial_map:nn { ten } { 拾 } +\zhnum_set_financial_map:nn { hundred } { 佰 } +\zhnum_set_financial_map:nn { thousand } { 仟 } +\ExplSyntaxOff +%% +%% This package consists of the file zhnumber.dtx, +%% and the derived files zhnumber.pdf, +%% zhnumber.sty, +%% zhnumber-utf8.cfg, +%% zhnumber-gbk.cfg, +%% zhnumber-big5.cfg, +%% zhnumber.ins and +%% README. +%% +%% End of file `zhnumber-big5.cfg'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg index ef92991cae4..ddb11b0af3c 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-gbk.cfg @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% zhnumber.dtx (with options: `config-gbk') +%% zhnumber.dtx (with options: `config,gbk') %% %% Copyright (C) 2012 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- @@ -19,44 +19,75 @@ %% This work has the LPPL maintenance status "maintained". %% The Current Maintainer of this work is Qing Lee. %% -\ExplSyntaxOff -\ProvidesExplFile {zhnumber-gbk.cfg} - {2012/05/21} {1.4} - {Chinese numerals with GBK encoding} -\tl_set:Nn \c_zhnum_minus_tl { \bool_if:NTF \l_zhnum_simp_bool { 蛹 } { } } -\tl_set:Nn \c_zhnum_zero_tl { \bool_if:nTF \l_zhnum_null_bool \c_zhnum_null_tl { 錨 } } -\tl_set:Nn \c_zhnum_null_tl { \bool_if:NTF \l_zhnum_normal_bool { } { 錨 } } -\tl_set:Nn \c_zhnum_one_tl { \bool_if:NTF \l_zhnum_normal_bool { 珨 } { 瓞 } } -\tl_set:Nn \c_zhnum_two_tl { \bool_if:NTF \l_zhnum_normal_bool { 媼 } { \bool_if:NTF \l_zhnum_simp_bool { 楚 } { 愓 } } } -\tl_set:Nn \c_zhnum_three_tl { \bool_if:NTF \l_zhnum_normal_bool { } { \bool_if:NTF \l_zhnum_simp_bool { } { } } } -\tl_set:Nn \c_zhnum_four_tl { \bool_if:NTF \l_zhnum_normal_bool { 侐 } { 佹 } } -\tl_set:Nn \c_zhnum_five_tl { \bool_if:NTF \l_zhnum_normal_bool { 拻 } { 斪 } } -\tl_set:Nn \c_zhnum_six_tl { \bool_if:NTF \l_zhnum_normal_bool { 鞠 } { \bool_if:NTF \l_zhnum_simp_bool { 翻 } { } } } -\tl_set:Nn \c_zhnum_seven_tl { \bool_if:NTF \l_zhnum_normal_bool { ほ } { ま } } -\tl_set:Nn \c_zhnum_eight_tl { \bool_if:NTF \l_zhnum_normal_bool { 匐 } { 副 } } -\tl_set:Nn \c_zhnum_nine_tl { \bool_if:NTF \l_zhnum_normal_bool { 嬝 } { 墾 } } -\tl_set:Nn \c_zhnum_ten_tl { \bool_if:NTF \l_zhnum_normal_bool { 坋 } { 夆 } } -\tl_set:Nn \c_zhnum_hundred_tl { \bool_if:NTF \l_zhnum_normal_bool { 啃 } { 唱 } } -\tl_set:Nn \c_zhnum_thousand_tl { \bool_if:NTF \l_zhnum_normal_bool { ロ } { ヰ } } -\tl_set:Nn \c_zhnum_twenty_tl { 堨 } -\tl_set:Nn \c_zhnum_thirty_tl { 埵 } -\tl_set:Nn \c_zhnum_forty_tl { c } -\tl_set:Nn \c_zhnum_two_hundred_tl { 釙 } -\tl_set:Nn \c_zhnum_dot_tl { \bool_if:NTF \l_zhnum_simp_bool { 萸 } { c } } -\tl_set:Nn \c_zhnum_and_tl { 衱 } -\tl_set:Nn \c_zhnum_over_tl { 煦眳 } -\tl_set:Nn \c_zhnum_scale_zero_tl { } -\tl_set:Nn \c_zhnum_scale_one_tl { \bool_if:NTF \l_zhnum_simp_bool { 勀 } { f } } -\tl_set:Nn \c_zhnum_scale_two_tl { \bool_if:NTF \l_zhnum_simp_bool { 砬 } { | } } -\tl_set:Nn \c_zhnum_scale_three_tl { 欳 } -\tl_set:Nn \c_zhnum_scale_four_tl { 儔 } -\tl_set:Nn \c_zhnum_scale_five_tl { 跍 } -\tl_set:Nn \c_zhnum_scale_six_tl { 濼 } -\tl_set:Nn \c_zhnum_scale_seven_tl { 藀 } -\tl_set:Nn \c_zhnum_scale_eight_tl { \bool_if:NTF \l_zhnum_simp_bool { 僱 } { } } -\tl_set:Nn \c_zhnum_scale_nine_tl { \bool_if:NTF \l_zhnum_simp_bool { 膚 } { } } -\tl_set:Nn \c_zhnum_scale_ten_tl { 淏 } -\tl_set:Nn \c_zhnum_scale_eleven_tl { \bool_if:NTF \l_zhnum_simp_bool { 婥 } { 徭 } } +\GetIdInfo$Id: zhnumber.dtx 351 2012-07-20 05:30:58Z sobenlee $ + {Chinese numerals with Big5 encoding} +\ProvidesExplFile + {\ExplFileName-gbk.cfg} + {\ExplFileDate} {1.6} {\ExplFileDescription} +\zhnum_set_digits_map:nnn { minus } { simp } { 蛹 } +\zhnum_set_digits_map:nnn { minus } { trad } { } +\zhnum_set_digits_map:nn { zero } { 錨 } +\zhnum_set_digits_map:nn { null } { } +\zhnum_set_digits_map:nn { one } { 珨 } +\zhnum_set_digits_map:nn { two } { 媼 } +\zhnum_set_digits_map:nn { three } { } +\zhnum_set_digits_map:nn { four } { 侐 } +\zhnum_set_digits_map:nn { five } { 拻 } +\zhnum_set_digits_map:nn { six } { 鞠 } +\zhnum_set_digits_map:nn { seven } { ほ } +\zhnum_set_digits_map:nn { eight } { 匐 } +\zhnum_set_digits_map:nn { nine } { 嬝 } +\zhnum_set_digits_map:nn { ten } { 坋 } +\zhnum_set_digits_map:nn { hundred } { 啃 } +\zhnum_set_digits_map:nn { thousand } { ロ } +\zhnum_set_digits_map:nn { twenty } { 堨 } +\zhnum_set_digits_map:nn { thirty } { 埵 } +\zhnum_set_digits_map:nn { forty } { c } +\zhnum_set_digits_map:nn { two_hundred } { 釙 } +\zhnum_set_digits_map:nnn { dot } { simp } { 萸 } +\zhnum_set_digits_map:nnn { dot } { trad } { c } +\zhnum_set_digits_map:nn { and } { 衱 } +\zhnum_set_digits_map:nn { parts } { 煦眳 } +\zhnum_set_digits_map:nn { scale_zero } { } +\zhnum_set_digits_map:nnn { scale_one } { simp } { 勀 } +\zhnum_set_digits_map:nnn { scale_one } { trad } { f } +\zhnum_set_digits_map:nnn { scale_two } { simp } { 砬 } +\zhnum_set_digits_map:nnn { scale_two } { trad } { | } +\zhnum_set_digits_map:nn { scale_three } { 欳 } +\zhnum_set_digits_map:nn { scale_four } { 儔 } +\zhnum_set_digits_map:nn { scale_five } { 跍 } +\zhnum_set_digits_map:nn { scale_six } { 濼 } +\zhnum_set_digits_map:nn { scale_seven } { 藀 } +\zhnum_set_digits_map:nnn { scale_eight } { simp } { 僱 } +\zhnum_set_digits_map:nnn { scale_eight } { trad } { } +\zhnum_set_digits_map:nnn { scale_nine } { simp } { 膚 } +\zhnum_set_digits_map:nnn { scale_nine } { trad } { } +\zhnum_set_digits_map:nn { scale_ten } { 淏 } +\zhnum_set_digits_map:nnn { scale_eleven } { simp } { 婥 } +\zhnum_set_digits_map:nnn { scale_eleven } { trad } { 徭 } +\zhnum_set_digits_map:nn { year } { 爛 } +\zhnum_set_digits_map:nn { month } { 堎 } +\zhnum_set_digits_map:nn { day } { } +\zhnum_set_digits_map:nnn { hour } { simp } { 奀 } +\zhnum_set_digits_map:nnn { hour } { trad } { r } +\zhnum_set_digits_map:nn { minute } { 煦 } +\zhnum_set_digits_map:nn { weekday } { 陎ぶ } +\zhnum_set_financial_map:nn { null } { 錨 } +\zhnum_set_financial_map:nn { zero } { 錨 } +\zhnum_set_financial_map:nn { one } { 瓞 } +\zhnum_set_financial_map:nn { two } { 愓 } +\zhnum_set_financial_map:nnn { three } { simp } { } +\zhnum_set_financial_map:nnn { three } { trad } { } +\zhnum_set_financial_map:nn { four } { 佹 } +\zhnum_set_financial_map:nn { five } { 斪 } +\zhnum_set_financial_map:nnn { six } { simp } { 翻 } +\zhnum_set_financial_map:nnn { six } { trad } { } +\zhnum_set_financial_map:nn { seven } { ま } +\zhnum_set_financial_map:nn { eight } { 副 } +\zhnum_set_financial_map:nn { nine } { 墾 } +\zhnum_set_financial_map:nn { ten } { 夆 } +\zhnum_set_financial_map:nn { hundred } { 唱 } +\zhnum_set_financial_map:nn { thousand } { ヰ } \ExplSyntaxOff %% %% This package consists of the file zhnumber.dtx, @@ -64,7 +95,8 @@ %% zhnumber.sty, %% zhnumber-utf8.cfg, %% zhnumber-gbk.cfg, +%% zhnumber-big5.cfg, %% zhnumber.ins and -%% README.txt. +%% README. %% %% End of file `zhnumber-gbk.cfg'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg index acba3e53cda..56ef8ea5cdf 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/config/zhnumber-utf8.cfg @@ -4,7 +4,7 @@ %% %% The original source files were: %% -%% zhnumber.dtx (with options: `config-utf8') +%% zhnumber.dtx (with options: `config,utf8') %% %% Copyright (C) 2012 by Qing Lee <sobenlee@gmail.com> %% -------------------------------------------------------------------------- @@ -19,44 +19,75 @@ %% This work has the LPPL maintenance status "maintained". %% The Current Maintainer of this work is Qing Lee. %% -\ExplSyntaxOff -\ProvidesExplFile {zhnumber-utf8.cfg} - {2012/05/21} {1.4} - {Chinese numerals with UTF8 encoding} -\tl_set:Nn \c_zhnum_minus_tl { \bool_if:NTF \l_zhnum_simp_bool { 韐 } { 鞎 } } -\tl_set:Nn \c_zhnum_zero_tl { \bool_if:nTF \l_zhnum_null_bool \c_zhnum_null_tl { } } -\tl_set:Nn \c_zhnum_null_tl { \bool_if:NTF \l_zhnum_normal_bool { } { } } -\tl_set:Nn \c_zhnum_one_tl { \bool_if:NTF \l_zhnum_normal_bool { 銝 } { 憯 } } -\tl_set:Nn \c_zhnum_two_tl { \bool_if:NTF \l_zhnum_normal_bool { 鈭 } { \bool_if:NTF \l_zhnum_simp_bool { 韐 } { 鞎 } } } -\tl_set:Nn \c_zhnum_three_tl { \bool_if:NTF \l_zhnum_normal_bool { 銝 } { \bool_if:NTF \l_zhnum_simp_bool { } { } } } -\tl_set:Nn \c_zhnum_four_tl { \bool_if:NTF \l_zhnum_normal_bool { } { } } -\tl_set:Nn \c_zhnum_five_tl { \bool_if:NTF \l_zhnum_normal_bool { 鈭 } { 隡 } } -\tl_set:Nn \c_zhnum_six_tl { \bool_if:NTF \l_zhnum_normal_bool { } { \bool_if:NTF \l_zhnum_simp_bool { } { } } } -\tl_set:Nn \c_zhnum_seven_tl { \bool_if:NTF \l_zhnum_normal_bool { 銝 } { } } -\tl_set:Nn \c_zhnum_eight_tl { \bool_if:NTF \l_zhnum_normal_bool { } { } } -\tl_set:Nn \c_zhnum_nine_tl { \bool_if:NTF \l_zhnum_normal_bool { 銋 } { } } -\tl_set:Nn \c_zhnum_ten_tl { \bool_if:NTF \l_zhnum_normal_bool { } { } } -\tl_set:Nn \c_zhnum_hundred_tl { \bool_if:NTF \l_zhnum_normal_bool { } { 雿 } } -\tl_set:Nn \c_zhnum_thousand_tl { \bool_if:NTF \l_zhnum_normal_bool { } { 隞 } } -\tl_set:Nn \c_zhnum_twenty_tl { 撱 } -\tl_set:Nn \c_zhnum_thirty_tl { } -\tl_set:Nn \c_zhnum_forty_tl { } -\tl_set:Nn \c_zhnum_two_hundred_tl { } -\tl_set:Nn \c_zhnum_dot_tl { \bool_if:NTF \l_zhnum_simp_bool { } { 暺 } } -\tl_set:Nn \c_zhnum_and_tl { } -\tl_set:Nn \c_zhnum_over_tl { 銋 } -\tl_set:Nn \c_zhnum_scale_zero_tl { } -\tl_set:Nn \c_zhnum_scale_one_tl { \bool_if:NTF \l_zhnum_simp_bool { 銝 } { } } -\tl_set:Nn \c_zhnum_scale_two_tl { \bool_if:NTF \l_zhnum_simp_bool { 鈭 } { } } -\tl_set:Nn \c_zhnum_scale_three_tl { } -\tl_set:Nn \c_zhnum_scale_four_tl { 鈭 } -\tl_set:Nn \c_zhnum_scale_five_tl { } -\tl_set:Nn \c_zhnum_scale_six_tl { 蝘 } -\tl_set:Nn \c_zhnum_scale_seven_tl { 蝛 } -\tl_set:Nn \c_zhnum_scale_eight_tl { \bool_if:NTF \l_zhnum_simp_bool { 瘝 } { 皞 } } -\tl_set:Nn \c_zhnum_scale_nine_tl { \bool_if:NTF \l_zhnum_simp_bool { 瘨 } { 瞉 } } -\tl_set:Nn \c_zhnum_scale_ten_tl { 甇 } -\tl_set:Nn \c_zhnum_scale_eleven_tl { \bool_if:NTF \l_zhnum_simp_bool { 頧 } { 頛 } } +\GetIdInfo$Id: zhnumber.dtx 351 2012-07-20 05:30:58Z sobenlee $ + {Chinese numerals with UTF8 encoding} +\ProvidesExplFile + {\ExplFileName-utf8.cfg} + {\ExplFileDate} {1.6} {\ExplFileDescription} +\zhnum_set_digits_map:nnn { minus } { simp } { 韐 } +\zhnum_set_digits_map:nnn { minus } { trad } { 鞎 } +\zhnum_set_digits_map:nn { zero } { } +\zhnum_set_digits_map:nn { null } { } +\zhnum_set_digits_map:nn { one } { 銝 } +\zhnum_set_digits_map:nn { two } { 鈭 } +\zhnum_set_digits_map:nn { three } { 銝 } +\zhnum_set_digits_map:nn { four } { } +\zhnum_set_digits_map:nn { five } { 鈭 } +\zhnum_set_digits_map:nn { six } { } +\zhnum_set_digits_map:nn { seven } { 銝 } +\zhnum_set_digits_map:nn { eight } { } +\zhnum_set_digits_map:nn { nine } { 銋 } +\zhnum_set_digits_map:nn { ten } { } +\zhnum_set_digits_map:nn { hundred } { } +\zhnum_set_digits_map:nn { thousand } { } +\zhnum_set_digits_map:nn { twenty } { 撱 } +\zhnum_set_digits_map:nn { thirty } { } +\zhnum_set_digits_map:nn { forty } { } +\zhnum_set_digits_map:nn { two_hundred } { } +\zhnum_set_digits_map:nnn { dot } { simp } { } +\zhnum_set_digits_map:nnn { dot } { trad } { 暺 } +\zhnum_set_digits_map:nn { and } { } +\zhnum_set_digits_map:nn { parts } { 銋 } +\zhnum_set_digits_map:nn { scale_zero } { } +\zhnum_set_digits_map:nnn { scale_one } { simp } { 銝 } +\zhnum_set_digits_map:nnn { scale_one } { trad } { } +\zhnum_set_digits_map:nnn { scale_two } { simp } { 鈭 } +\zhnum_set_digits_map:nnn { scale_two } { trad } { } +\zhnum_set_digits_map:nn { scale_three } { } +\zhnum_set_digits_map:nn { scale_four } { 鈭 } +\zhnum_set_digits_map:nn { scale_five } { } +\zhnum_set_digits_map:nn { scale_six } { 蝘 } +\zhnum_set_digits_map:nn { scale_seven } { 蝛 } +\zhnum_set_digits_map:nnn { scale_eight } { simp } { 瘝 } +\zhnum_set_digits_map:nnn { scale_eight } { trad } { 皞 } +\zhnum_set_digits_map:nnn { scale_nine } { simp } { 瘨 } +\zhnum_set_digits_map:nnn { scale_nine } { trad } { 瞉 } +\zhnum_set_digits_map:nn { scale_ten } { 甇 } +\zhnum_set_digits_map:nnn { scale_eleven } { simp } { 頧 } +\zhnum_set_digits_map:nnn { scale_eleven } { trad } { 頛 } +\zhnum_set_digits_map:nn { year } { 撟 } +\zhnum_set_digits_map:nn { month } { } +\zhnum_set_digits_map:nn { day } { } +\zhnum_set_digits_map:nnn { hour } { simp } { } +\zhnum_set_digits_map:nnn { hour } { trad } { } +\zhnum_set_digits_map:nn { minute } { } +\zhnum_set_digits_map:nn { weekday } { } +\zhnum_set_financial_map:nn { null } { } +\zhnum_set_financial_map:nn { zero } { } +\zhnum_set_financial_map:nn { one } { 憯 } +\zhnum_set_financial_map:nn { two } { 鞎 } +\zhnum_set_financial_map:nnn { three } { simp } { } +\zhnum_set_financial_map:nnn { three } { trad } { } +\zhnum_set_financial_map:nn { four } { } +\zhnum_set_financial_map:nn { five } { 隡 } +\zhnum_set_financial_map:nnn { six } { simp } { } +\zhnum_set_financial_map:nnn { six } { trad } { } +\zhnum_set_financial_map:nn { seven } { } +\zhnum_set_financial_map:nn { eight } { } +\zhnum_set_financial_map:nn { nine } { } +\zhnum_set_financial_map:nn { ten } { } +\zhnum_set_financial_map:nn { hundred } { 雿 } +\zhnum_set_financial_map:nn { thousand } { 隞 } \ExplSyntaxOff %% %% This package consists of the file zhnumber.dtx, @@ -64,7 +95,8 @@ %% zhnumber.sty, %% zhnumber-utf8.cfg, %% zhnumber-gbk.cfg, +%% zhnumber-big5.cfg, %% zhnumber.ins and -%% README.txt. +%% README. %% %% End of file `zhnumber-utf8.cfg'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty index 387b52eb429..d46e95263d4 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty @@ -21,9 +21,9 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\ProvidesExplPackage {zhnumber} - {2012/05/21} {1.4} - {package for typesetting numbers with Chinese glyphs} +\GetIdInfo$Id: zhnumber.dtx 351 2012-07-20 05:30:58Z sobenlee $ + {package for typesetting numbers with Chinese glyphs} +\ProvidesExplPackage{\ExplFileName}{\ExplFileDate}{1.6}{\ExplFileDescription} \msg_new:nnn { zhnumber } { l3-too-old } { Support~package~'expl3'~too~old. \\\\ @@ -31,7 +31,7 @@ 'l3kernel'~and~'l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2012/02/19 } { } +\@ifpackagelater { expl3 } { 2012/07/16 } { } { \msg_error:nn { zhnumber } { l3-too-old } } \RequirePackage{xparse} \RequirePackage{l3keys2e} @@ -59,12 +59,12 @@ { \quark_if_nil:nTF {#3} { - \zhnum_blank_to_zero:f {#1} \c_zhnum_over_tl + \zhnum_blank_to_zero:f {#1} \c_zhnum_parts_tl \zhnum_blank_to_zero:f {#2} } { \tl_if_blank:fF {#2} { \zhnumber {#2} \c_zhnum_and_tl } - \zhnum_blank_to_zero:f {#1} \c_zhnum_over_tl + \zhnum_blank_to_zero:f {#1} \c_zhnum_parts_tl \zhnum_blank_to_zero:f {#3} } } @@ -72,7 +72,7 @@ \cs_new_nopar:Nn \zhnum_decimal:nn { \zhnum_blank_to_zero:f {#1} \c_zhnum_dot_tl - \tl_if_blank:fTF {#2} { \zhnum_digit_map:n \c_zero } { \zhdigits * {#2} } + \tl_if_blank:fTF {#2} { \c_zhnum_zero_tl } { \zhdigits * {#2} } } \cs_generate_variant:Nn \tl_if_blank:nTF { f } \cs_new_nopar:Nn \zhnum_blank_to_zero:n @@ -87,19 +87,14 @@ { \@nocounterr {#1} } } \cs_new_nopar:Nn \zhnum_integer:n - { \zhnum_integer_aux:f { \zhnum_erase_separator:n {#1} } } -\cs_new_nopar:Nn \zhnum_integer_aux:n { - \int_compare:nNnT { \int_get_sign:n {#1} \c_one } < \c_zero - { \zhnum_digit_map:n \c_minus_one } - \zhnum_parse_number:f { \zhnum_trim_zeros:f { \int_get_digits:n {#1} } } + \int_compare:nNnT { \__int_get_sign:n {#1} \c_one } < \c_zero { \c_zhnum_minus_tl } + \zhnum_parse_number:f { \zhnum_trim_zeros:f { \zhnum_erase_separator:n {#1} } } } -\cs_generate_variant:Nn \zhnum_integer:n { f , v } -\cs_generate_variant:Nn \zhnum_integer_aux:n { f } +\cs_generate_variant:Nn \zhnum_integer:n { f , v , V } \cs_new_nopar:Nn \zhnum_erase_separator:n { \cs_to_str:c { \tl_map_function:nN {#1} \zhnum_erase_separator_aux:N } } -\cs_new_nopar:Nn \zhnum_erase_separator_aux:N - { \str_if_eq:xxF {#1} \c_zhnum_separator_tl {#1} } +\cs_new_nopar:Nn \zhnum_erase_separator_aux:N { \zhnum_if_number:NT {#1} {#1} } \cs_new_nopar:Nn \zhnum_trim_zeros:n { \tl_if_empty:nTF {#1} \c_zero @@ -108,149 +103,121 @@ { \zhnum_trim_zeros:o { \use_none:n #1 } } {#1} } } +\prg_new_conditional:Nnn \zhnum_if_number:N { p , T , F , TF } + { + \if_int_compare:w \c_one < 1 #1 \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + } \cs_generate_variant:Nn \zhnum_trim_zeros:n { f , o } \cs_generate_variant:Nn \cs_to_str:N { c } \cs_new_nopar:Nn \zhnum_parse_number:n - { \zhnum_parse_number:nf {#1} { \tl_length:n {#1} } } -\cs_new_nopar:Nn \zhnum_parse_number:nn { - \int_compare:nNnTF {#2} < \c_five - { - \int_compare:nNnTF {#1} = \c_zero - { \zhnum_digit_map:n \c_zero } - { \zhnum_process_number:NNn \c_true_bool \c_true_bool {#1} } - } + \zhnum_parse_number:nff {#1} + { \tl_count:n {#1} } + { \int_mod:nn { \tl_count:n {#1} } \c_four } + } +\cs_new_nopar:Nn \zhnum_parse_number:nnn + { + \int_compare:nNnTF {#2} < \c_two + { \zhnum_digit_map:n {#1} } { - \int_compare:nNnTF { \int_mod:nn {#2} \c_four } = \c_zero + \zhnum_split_number:fNNfn { \zhnum_insert_zeros:n {#3} #1 } + \c_true_bool \c_true_bool { - \zhnum_split_number:nNNnfn {#1} \c_true_bool \c_true_bool { \c_zero } - { \int_div_truncate:nn { #2 - \c_one } \c_four } - { \c_zero } - } - { - \zhnum_parse_number:nnf {#1} {#2} - { - \use:c - { - zhnum_use_ - \int_to_roman:n { \int_mod:nn {#2} \c_four } - _delimit_by_q_stop:w - } - #1 \q_stop - } + \int_compare:nNnTF {#3} = \c_zero + { \int_eval:n { (#2) / \c_four - \c_one } } + { \int_div_truncate:nn {#2} \c_four } } + { \c_zero } } } -\cs_new_nopar:Nn \zhnum_parse_number:nnn +\cs_generate_variant:Nn \zhnum_parse_number:n { f } +\cs_generate_variant:Nn \zhnum_parse_number:nnn { nff } +\cs_new_nopar:Nn \zhnum_insert_zeros:n { - \zhnum_process_number:NNn \c_true_bool \c_true_bool {#3} - \zhnum_scale_map:n { \int_div_truncate:nn { #2 - \c_one } \c_four } - \int_compare:nNnTF { \int_mod:nn {#3} \c_ten } = \c_zero - { \zhnum_split_number:nNNffn {#1} \c_false_bool \c_true_bool } - { \zhnum_split_number:nNNffn {#1} \c_true_bool \c_false_bool } - { \int_mod:nn {#2} \c_four } - { \int_eval:n { \int_div_truncate:nn { #2 - \c_one } \c_four - \c_one } } - { \c_zero } + \if_case:w \int_eval:n { #1 - \c_one } \exp_stop_f: + \or: \exp_after:wN \use_none:n + \or: \exp_after:wN \use_none:nn + \else: \exp_after:wN \use_none:nnn + \fi: + 000 } -\cs_generate_variant:Nn \zhnum_parse_number:n { f } -\cs_generate_variant:Nn \zhnum_parse_number:nn { nf } -\cs_generate_variant:Nn \zhnum_parse_number:nnn { nnf } -\cs_new_nopar:Npn \zhnum_use_i_delimit_by_q_stop:w #1#2 \q_stop {#1} -\cs_new_nopar:Npn \zhnum_use_ii_delimit_by_q_stop:w #1#2#3 \q_stop {#1#2} -\cs_new_nopar:Npn \zhnum_use_iii_delimit_by_q_stop:w #1#2#3#4 \q_stop {#1#2#3} -\cs_new_nopar:Nn \zhnum_split_number:nNNnnn +\cs_new_nopar:Nn \zhnum_split_number:nNNnn { - \exp_args:Nf \zhnum_split_number_aux:nnnnnnn - { \zhnum_number_item:nn {#1} { \c_one + #4 + #6 * \c_four } } - {#1} {#2} {#3} {#4} {#5} {#6} + \zhnum_split_number_aux:fnNNnn { \zhnum_number_item:nn {#1} {#5} } + {#1} #2#3 {#4} {#5} } -\cs_new_nopar:Nn \zhnum_split_number_aux:nnnnnnn +\cs_new_nopar:Nn \zhnum_split_number_aux:nnNNnn { \int_compare:nNnTF {#1} = \c_zero { \use_i_ii:nnn } { - \bool_if:NF #3 { \zhnum_digit_map:n \c_zero } - \zhnum_process_number:NNn {#3} {#4} {#1} - \zhnum_scale_map:n { #6 - #7 } + \bool_if:NF #3 { \c_zhnum_zero_tl } + \zhnum_process_number:NNn #3#4 {#1} + \zhnum_scale_map:n { #5 - #6 } \int_compare:nNnTF { \int_mod:nn {#1} \c_ten } = \c_zero { \use_i_ii:nnn } { \zhnum_use_i_iii:nnn } } - { \int_compare:nNnF { #6 - #7 } = \c_zero } + { \int_compare:nNnF {#5} = {#6} } { { - \zhnum_split_number:nNNnnf - {#2} \c_false_bool \c_true_bool {#5} {#6} { \int_eval:n { #7 + \c_one } } + \zhnum_split_number:nNNnf + {#2} \c_false_bool \c_true_bool {#5} { \int_eval:n { #6 + \c_one } } } } { { - \zhnum_split_number:nNNnnf - {#2} \c_true_bool \c_false_bool {#5} {#6} { \int_eval:n { #7 + \c_one } } + \zhnum_split_number:nNNnf + {#2} \c_true_bool \c_false_bool {#5} { \int_eval:n { #6 + \c_one } } } } } \cs_new_nopar:Nn \zhnum_use_i_iii:nnn {#1#3} -\cs_generate_variant:Nn \zhnum_split_number:nNNnnn { nNNnf , nNNff , nNNnnf } +\cs_generate_variant:Nn \zhnum_split_number:nNNnn { fNNf , nNNnf } +\cs_generate_variant:Nn \zhnum_split_number_aux:nnNNnn { f } \cs_new_nopar:Nn \zhnum_number_item:nn + { \zhnum_number_item_aux:nNNNN {#2} #1 \q_recursion_stop } +\cs_new_nopar:Nn \zhnum_number_item_aux:nNNNN { - \zhnum_number_item_aux:nN {#2} #1 - \q_recursion_tail - \prg_break_point:n { } - } -\cs_new_nopar:Nn \zhnum_number_item_aux:nN - { - \quark_if_recursion_tail_break:n {#2} - \int_compare:nNnTF {#1} = \c_one - { \zhnum_recursion_break:NNNNw #2 } - { \zhnum_number_item_aux:fN { \int_eval:n { #1 - \c_one } } } + \int_compare:nNnTF {#1} = \c_zero + { \zhnum_recursion_stop:NNNNw #2#3#4#5 } + { \zhnum_number_item_aux:fNNNN { \int_eval:n { #1 - \c_one } } } } -\cs_generate_variant:Nn \zhnum_number_item_aux:nN { f } -\cs_new_nopar:Npn \zhnum_recursion_break:NNNNw #1#2#3#4#5 \prg_break_point:n #6 {#1#2#3#4} +\cs_generate_variant:Nn \zhnum_number_item_aux:nNNNN { f } +\cs_new_nopar:Npn \zhnum_recursion_stop:NNNNw #1#2#3#4#5 \q_recursion_stop {#1#2#3#4} \cs_new_nopar:Nn \zhnum_process_number:NNn - { - \zhnum_process_number:ffffNN - { \int_mod:nn {#3} \c_ten } - { \int_mod:nn { \int_div_truncate:nn {#3} \c_ten } \c_ten } - { \int_mod:nn { \int_div_truncate:nn {#3} \c_one_hundred } \c_ten } - { \int_div_truncate:nn {#3} \c_one_thousand } - {#1} {#2} - } + { \zhnum_process_number:NNNNNN #3#1#2 } \cs_new_nopar:Nn \zhnum_process_number:NNNNNN { - \int_compare:nNnTF {#4} = \c_zero - { \bool_if:NF #6 { \zhnum_digit_map:n \c_zero } } - { \zhnum_digit_map:n {#4} \zhnum_digit_map:n \c_one_thousand } - \int_compare:nNnTF {#3} = \c_zero - { \int_compare:nNnT { #4 * (#2#1) } > \c_zero { \zhnum_digit_map:n \c_zero } } + \int_compare:nNnTF {#1} = \c_zero + { \bool_if:NF #6 { \c_zhnum_zero_tl } } + { \zhnum_digit_map:n {#1} \c_zhnum_thousand_tl } + \int_compare:nNnTF {#2} = \c_zero + { \int_compare:nNnT { #1 * (#3#4) } > \c_zero { \c_zhnum_zero_tl } } { \bool_if:nTF - { \l_zhnum_ancient_bool && \int_compare_p:nNn {#3} = \c_two } - { \zhnum_digit_map:n { #3 * \c_one_hundred } } - { \zhnum_digit_map:n {#3} \zhnum_digit_map:n \c_one_hundred } + { \l_zhnum_ancient_bool && \int_compare_p:nNn {#2} = \c_two } + { \zhnum_digit_map:n { #2 00 } } + { \zhnum_digit_map:n {#2} \c_zhnum_hundred_tl } } - \int_compare:nNnTF {#2} = \c_zero - { \int_compare:nNnT { #3 * #1 } > \c_zero { \zhnum_digit_map:n \c_zero } } + \int_compare:nNnTF {#3} = \c_zero + { \int_compare:nNnT { #2 * #4 } > \c_zero { \c_zhnum_zero_tl } } { \bool_if:nF { - \int_compare_p:nNn {#2} = \c_one && - \int_compare_p:nNn {#4#3} = \c_zero && #6 && #5 + \int_compare_p:nNn {#3} = \c_one && + \int_compare_p:nNn {#1#2} = \c_zero && #6 && #5 } { \bool_if:nTF { \l_zhnum_ancient_bool && - ( \int_compare_p:nNn {#2} = \c_two || - \int_compare_p:nNn {#2} = \c_three || - \int_compare_p:nNn {#2} = \c_four ) - } - { - \zhnum_digit_map:n { #2 * \c_ten } - \use_none:nn + ( \int_compare_p:nNn {#3} = \c_two || + \int_compare_p:nNn {#3} = \c_three || + \int_compare_p:nNn {#3} = \c_four ) } - { \zhnum_digit_map:n {#2} } + { \zhnum_digit_map:n { #3 0 } \use_none:n } + { \zhnum_digit_map:n {#3} } } - \zhnum_digit_map:n \c_ten + \c_zhnum_ten_tl } - \int_compare:nNnF {#1} = \c_zero { \zhnum_digit_map:n {#1} } + \int_compare:nNnF {#4} = \c_zero { \zhnum_digit_map:n {#4} } } -\cs_generate_variant:Nn \zhnum_process_number:NNn { NNf } -\cs_generate_variant:Nn \zhnum_process_number:NNNNNN { ffff } \DeclareExpandableDocumentCommand \zhdigits { s o m } { \IfBooleanTF {#1} @@ -262,113 +229,273 @@ \IfNoValueTF {#1} { \tl_map_function:fN {#2} #3 } { \group_begin: \zhnumsetup {#1} \tl_map_function:fN {#2} #3 \group_end: } } -\cs_generate_variant:Nn \tl_map_function:nN { f } -\cs_new_nopar:Nn \zhnum_digits_null_aux:N { \zhnum_digits_aux:nn \c_zhnum_null_int {#1} } -\cs_new_nopar:Nn \zhnum_digits_zero_aux:N { \zhnum_digits_aux:nn \c_zero {#1} } -\cs_new_nopar:Nn \zhnum_digits_aux:nn +\cs_new_nopar:Nn \zhnum_digits_null:n { \tl_map_function:fN {#1} \zhnum_digits_null_aux:N } +\cs_generate_variant:Nn \zhnum_digits_null:n { V } +\cs_generate_variant:Nn \tl_map_function:nN { f } +\cs_new_nopar:Nn \zhnum_digits_null_aux:N { \zhnum_digits_aux:NN \c_true_bool #1 } +\cs_new_nopar:Nn \zhnum_digits_zero_aux:N { \zhnum_digits_aux:NN \c_false_bool #1 } +\cs_new_nopar:Nn \zhnum_digits_aux:NN { - \str_if_eq:xxF {#2} \c_zhnum_separator_tl + \str_if_eq_x:nnTF {#2} . \c_zhnum_dot_tl { - \str_if_eq:xxTF {#2} . \c_zhnum_dot_tl + \str_if_eq_x:nnTF {#2} - + { \c_zhnum_minus_tl } { - \zhnum_digit_map:n + \zhnum_if_number:NT {#2} { - \str_if_eq:xxTF {#2} - \c_minus_one - { - \bool_if:nTF - { - \int_compare_p:nNn {#2} = \c_zero && - \int_compare_p:nNn {#1} = \c_zhnum_null_int - } - { \c_zhnum_null_int } {#2} - } + \bool_if:nTF { \int_compare_p:nNn {#2} = \c_zero } + { \bool_if:NTF #1 \c_zhnum_null_tl \c_zhnum_zero_tl } + { \zhnum_digit_map:n {#2} } } } } } -\int_const:Nn \c_zhnum_null_int { -10 } -\cs_new_nopar:Nn \zhnum_digit_map:n +\DeclareExpandableDocumentCommand \zhdate { s m } { - \prg_case_int:nnn {#1} + \zhnum_date:w #2 \q_stop + \IfBooleanT {#1} { \zhweekday {#2} } + } +\cs_new_nopar:Npn \zhnum_date:w #1/#2/#3 \q_stop + { + \zhnum_check_time:Nn \zhnum_digits_null:n {#1} \c_zhnum_year_tl + \zhnum_check_time:Nn \zhnum_integer:f {#2} \c_zhnum_month_tl + \zhnum_check_time:Nn \zhnum_integer:f {#3} \c_zhnum_day_tl + } +\cs_new_nopar:Npn \zhtoday + { + \zhnum_check_time:Nn \zhnum_digits_null:V \tex_year:D \c_zhnum_year_tl + \zhnum_check_time:Nn \zhnum_integer:V \tex_month:D \c_zhnum_month_tl + \zhnum_check_time:Nn \zhnum_integer:V \tex_day:D \c_zhnum_day_tl + } +\cs_new_nopar:Nn \zhnum_check_time:Nn + { \bool_if:NTF \l_zhnum_time_bool {#1} { \int_eval:n } {#2} } +\cs_new_nopar:Npn \zhweekday #1 { \zhnum_week_day:w #1 \q_stop } +\cs_new_nopar:Nn \zhnum_Zeller:nnn + { + \int_compare:nNnTF + { #1 \zhnum_two_digits:n {#2} \zhnum_two_digits:n {#3} } > { 1582 10 04 } + { \zhnum_Zeller_aux:Nnnn \zhnum_Zeller_Gregorian:nnn } + { \zhnum_Zeller_aux:Nnnn \zhnum_Zeller_Julian:nnn } + {#1} {#2} {#3} + } +\cs_new_nopar:Nn \zhnum_Zeller_aux:Nnnn + { + \int_compare:nNnTF {#3} < \c_three + { #1 { #2 - \c_one } { #3 + \c_twelve } {#4} } + { #1 {#2} {#3} {#4} } + } +\cs_new_nopar:Nn \zhnum_two_digits:n + { + \int_compare:nNnT {#1} < \c_ten { 0 } + \int_eval:n {#1} + } +\cs_new_nopar:Nn \zhnum_Zeller_Gregorian:nnn + { + \int_mod:nn { - { \c_minus_one } { \c_zhnum_minus_tl } - { \c_zero } { \c_zhnum_zero_tl } - { \c_one } { \c_zhnum_one_tl } - { \c_two } { \c_zhnum_two_tl } - { \c_three } { \c_zhnum_three_tl } - { \c_four } { \c_zhnum_four_tl } - { \c_five } { \c_zhnum_five_tl } - { \c_six } { \c_zhnum_six_tl } - { \c_seven } { \c_zhnum_seven_tl } - { \c_eight } { \c_zhnum_eight_tl } - { \c_nine } { \c_zhnum_nine_tl } - { \c_ten } { \c_zhnum_ten_tl } - { \c_one_hundred } { \c_zhnum_hundred_tl } - { \c_one_thousand } { \c_zhnum_thousand_tl } - { \c_zhnum_null_int } { \c_zhnum_null_tl } - { 20 } { \c_zhnum_twenty_tl } - { 30 } { \c_zhnum_thirty_tl } - { 40 } { \c_zhnum_forty_tl } - { 200 } { \c_zhnum_two_hundred_tl } + \int_eval:n {#3} + + \int_div_truncate:nn { 26 * ( \int_eval:n {#2} + \c_one ) } \c_ten + + \int_eval:n {#1} + + \int_div_truncate:nn {#1} \c_four + + \c_six * \int_div_truncate:nn {#1} \c_one_hundred + + \int_div_truncate:nn {#1} { 400 } } - { \prg_do_nothing: } + { \c_seven } } -\cs_new_nopar:Nn \zhnum_scale_map:n +\cs_new_nopar:Nn \zhnum_Zeller_Julian:nnn { - \prg_case_int:nnn {#1} + \int_mod:nn { - { \c_zero } { \c_zhnum_scale_zero_tl } - { \c_one } { \c_zhnum_scale_one_tl } - { \c_two } { \c_zhnum_scale_two_tl } - { \c_three } { \c_zhnum_scale_three_tl } - { \c_four } { \c_zhnum_scale_four_tl } - { \c_five } { \c_zhnum_scale_five_tl } - { \c_six } { \c_zhnum_scale_six_tl } - { \c_seven } { \c_zhnum_scale_seven_tl } - { \c_eight } { \c_zhnum_scale_eight_tl } - { \c_nine } { \c_zhnum_scale_nine_tl } - { \c_ten } { \c_zhnum_scale_ten_tl } - { \c_eleven } { \c_zhnum_scale_eleven_tl } + \int_eval:n {#3} + + \int_div_truncate:nn { 26 * ( \int_eval:n {#2} + \c_one ) } \c_ten + + \int_eval:n {#1} + + \int_div_truncate:nn {#1} \c_four + + \c_five } + { \c_seven } + } +\cs_new_nopar:Npn \zhnum_week_day:w #1/#2/#3 \q_stop + { + \if_case:w \int_eval:n { \zhnum_Zeller:nnn {#1} {#2} {#3} } \exp_stop_f: + \c_zhnum_sat_tl + \or: \c_zhnum_sun_tl + \or: \c_zhnum_mon_tl + \or: \c_zhnum_tue_tl + \or: \c_zhnum_wed_tl + \or: \c_zhnum_thu_tl + \or: \c_zhnum_fri_tl + \fi: + } +\cs_new_nopar:Npn \zhtime #1 { \zhnum_time:w #1 \q_stop } +\group_begin: +\char_set_lccode:nn { `\; } { `\: } +\tl_to_lowercase:n + { + \group_end: + \cs_new_nopar:Npn \zhnum_time:w #1 ; #2 \q_stop + { + \zhnum_check_time:Nn \zhnum_integer:f {#1} \c_zhnum_hour_tl + \zhnum_check_time:Nn \zhnum_integer:f {#2} \c_zhnum_minute_tl + } + } +\cs_new_nopar:Npn \zhcurrtime + { + \zhnum_check_time:Nn \zhnum_integer:f + { \int_div_truncate:nn \tex_time:D { 60 } } \c_zhnum_hour_tl + \zhnum_check_time:Nn \zhnum_integer:f + { \int_mod:nn \tex_time:D { 60 } } \c_zhnum_minute_tl + } +\cs_new_nopar:Nn \zhnum_digit_map:n + { \tl_use:c { c_zhnum_ \zhnum_int_to_word:n {#1} _tl } } +\cs_new_nopar:Nn \zhnum_scale_map:n + { + \cs_if_exist_use:cF { c_zhnum_scale_ \zhnum_int_to_word:n {#1} _tl } { \zhnum_scale_map_hook:n {#1} } } -\cs_new_nopar:Nn \zhnum_scale_map_hook:n - { \zhnum_scale_map:n { \int_mod:nn {#1} \c_eleven } } +\cs_new_nopar:Nn \zhnum_scale_map_loop:n + { \zhnum_scale_map:n { \int_mod:nn {#1} \g_zhnum_scale_int } } +\int_new:N \g_zhnum_scale_int +\int_set_eq:NN \g_zhnum_scale_int \c_eleven +\cs_new_eq:NN \zhnum_scale_map_hook:n \zhnum_scale_map_loop:n +\NewDocumentCommand \zhnumExtendScaleMap { > { \TrimSpaces } o m } + { + \int_zero:N \l_tmpa_int + \clist_map_inline:nn {#2} + { + \int_incr:N \l_tmpa_int + \tl_set:Nx \l_tmpa_tl + { c_zhnum_scale_ \zhnum_int_to_word:n { \l_tmpa_int + \c_eleven } _tl } + \tl_if_exist:cF \l_tmpa_tl { \int_incr:N \g_zhnum_scale_int } + \tl_set:cn { \l_tmpa_tl } {##1} + } + \IfValueT {#1} { \cs_set:Nn \zhnum_scale_map_hook:n {#1} } + } +\cs_new_nopar:Nn \zhnum_int_to_word:n + { + \if_case:w \int_eval:n {#1} \exp_stop_f: + zero + \or: one + \or: two + \or: three + \or: four + \or: five + \or: six + \or: seven + \or: eight + \or: nine + \or: ten + \or: eleven + \else: + \int_case:nnn {#1} + { + { 20 } { twenty } { 30 } { thirty } + { 40 } { forty } { 200 } { two_hundred } + } + { \int_to_roman:n {#1} } + \fi: + } \keys_define:nn { zhnum / options } { - - .tl_set:N = \c_zhnum_minus_tl , - -0 .tl_set:N = \c_zhnum_null_tl , - 0 .tl_set:N = \c_zhnum_zero_tl , - 1 .tl_set:N = \c_zhnum_one_tl , - 2 .tl_set:N = \c_zhnum_two_tl , - 3 .tl_set:N = \c_zhnum_three_tl , - 4 .tl_set:N = \c_zhnum_four_tl , - 5 .tl_set:N = \c_zhnum_five_tl , - 6 .tl_set:N = \c_zhnum_six_tl , - 7 .tl_set:N = \c_zhnum_seven_tl , - 8 .tl_set:N = \c_zhnum_eight_tl , - 9 .tl_set:N = \c_zhnum_nine_tl , - 10 .tl_set:N = \c_zhnum_ten_tl , - 20 .tl_set:N = \c_zhnum_twenty_tl , - 30 .tl_set:N = \c_zhnum_thirty_tl , - 40 .tl_set:N = \c_zhnum_forty_tl , - 200 .tl_set:N = \c_zhnum_two_hundred_tl , - E2 .tl_set:N = \c_zhnum_hundred_tl , - E3 .tl_set:N = \c_zhnum_thousand_tl , - E4 .tl_set:N = \c_zhnum_scale_one_tl , - E8 .tl_set:N = \c_zhnum_scale_two_tl , - E12 .tl_set:N = \c_zhnum_scale_three_tl , - E16 .tl_set:N = \c_zhnum_scale_four_tl , - E20 .tl_set:N = \c_zhnum_scale_five_tl , - E24 .tl_set:N = \c_zhnum_scale_six_tl , - E28 .tl_set:N = \c_zhnum_scale_seven_tl , - E32 .tl_set:N = \c_zhnum_scale_eight_tl , - E36 .tl_set:N = \c_zhnum_scale_nine_tl , - E40 .tl_set:N = \c_zhnum_scale_ten_tl , - E44 .tl_set:N = \c_zhnum_scale_eleven_tl , - } -\cs_new:Nn \zhnum_load_cfg: + - .tl_set:N = \l_zhnum_minus_tl , + -0 .tl_set:N = \l_zhnum_null_tl , + E2 .tl_set:N = \l_zhnum_hundred_tl , + E3 .tl_set:N = \l_zhnum_thousand_tl , + FE2 .tl_set:N = \l_zhnum_financial_hundred_tl , + FE3 .tl_set:N = \l_zhnum_financial_thousand_tl , + } +\clist_map_inline:nn + { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 20 , 30 , 40 , 200 } + { + \keys_define:nn { zhnum / options } + { #1 .tl_set:c = { l_zhnum_ \zhnum_int_to_word:n {#1} _tl } } + \int_compare:nNnF {#1} > \c_ten + { + \keys_define:nn { zhnum / options } + { F#1 .tl_set:c = { l_zhnum_financial_ \zhnum_int_to_word:n {#1} _tl } } + } + } +\clist_map_inline:nn + { 4 , 8 , 12 , 16 , 20 , 24 , 28 , 32 , 36 , 40 , 44 } + { + \keys_define:nn { zhnum / options } + { E#1 .tl_set:c = { l_zhnum_scale_ \zhnum_int_to_word:n { #1 / 4 } _tl } } + } +\clist_map_inline:nn + { + dot , and , parts , year , month , day , weekday , hour , minute + mon , tue , wed , thu , fri , sat , sun + } + { \keys_define:nn { zhnum / options } { #1 .tl_set:c = { l_zhnum_ #1 _tl } } } +\cs_new_nopar:Nn \zhnum_parse_config: + { + \prop_map_function:NN \g_zhnum_cfg_map_prop \zhnum_check_simp:nn + \prop_map_function:NN \g_zhnum_cfg_map_prop \zhnum_check_financial:nn + \zhnum_set_zero: + \zhnum_set_week_day: + } +\cs_new_nopar:Nn \zhnum_check_simp:nn + { + \zhnum_check_simp_aux:nn {#1} {#2} + \prop_get:NnNT \g_zhnum_cfg_map_finan_prop {#1} \l_tmpa_tl + { \exp_args:NnV \zhnum_check_simp_aux:nn { financial_ #1 } \l_tmpa_tl } + } +\cs_new_nopar:Nn \zhnum_check_simp_aux:nn + { + \prop_get:NnNTF \g_zhnum_cfg_map_var_prop { #1 _trad } \l_tmpa_tl + { + \prop_get:NnNTF \g_zhnum_cfg_map_var_prop { #1 _simp } \l_tmpb_tl + { + \tl_set:cx { l_zhnum_ #1 _tl } + { + \exp_not:n { \bool_if:NTF \l_zhnum_simp_bool } + { \exp_not:V \l_tmpb_tl } { \exp_not:V \l_tmpa_tl } + } + } + { + \tl_set:cx { l_zhnum_ #1 _tl } + { + \exp_not:n { \bool_if:NTF \l_zhnum_simp_bool } + { \exp_not:n {#2} } { \exp_not:V \l_tmpa_tl } + } + } + } + { \tl_set:cn { l_zhnum_ #1 _tl } {#2} } + } +\cs_new_nopar:Nn \zhnum_check_financial:nn + { + \prop_get:NnNTF \g_zhnum_cfg_map_finan_prop {#1} \l_tmpa_tl + { + \tl_set:cx { c_zhnum_ #1 _tl } + { + \exp_not:n { \bool_if:NTF \l_zhnum_normal_bool } + { \exp_not:c { l_zhnum_ #1 _tl } } + { \exp_not:c { l_zhnum_financial_ #1 _tl } } + } + } + { \tl_set:cx { c_zhnum_ #1 _tl } { \exp_not:c { l_zhnum_ #1 _tl } } } + } +\cs_new_nopar:Nn \zhnum_set_zero: + { + \tl_set:Nx \l_zhnum_zero_tl + { + \exp_not:n { \bool_if:nTF \l_zhnum_null_bool } + { \exp_not:V \l_zhnum_null_tl } { \exp_not:V \l_zhnum_zero_tl } + } + } +\cs_new_nopar:Nn \zhnum_set_week_day: + { + \tl_set:Nx \l_zhnum_mon_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_one_tl } + \tl_set:Nx \l_zhnum_tue_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_two_tl } + \tl_set:Nx \l_zhnum_wed_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_three_tl } + \tl_set:Nx \l_zhnum_thu_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_four_tl } + \tl_set:Nx \l_zhnum_fri_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_five_tl } + \tl_set:Nx \l_zhnum_sat_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_six_tl } + \tl_set:Nx \l_zhnum_sun_tl { \exp_not:N \c_zhnum_weekday_tl \exp_not:V \l_zhnum_day_tl } + \clist_map_inline:nn { mon , tue , wed , thu , fri , sat , sun } + { \tl_set:cx { c_zhnum_ ##1 _tl } { \exp_not:c { l_zhnum_ ##1 _tl } } } + } +\cs_new:Nn \zhnum_load_cfg:n { \cs_if_exist:NT \CJK@makeActive { @@ -376,51 +503,84 @@ { \bool_set_false:N \l_zhnum_set_CJK_active_bool } { \bool_set_true:N \l_zhnum_set_CJK_active_bool \CJK@makeActive } } - \file_input:n { zhnumber - \bool_if:NTF \g_zhnum_gbk_bool { gbk } { utf8 } .cfg } + \prop_clear:N \g_zhnum_cfg_map_prop + \prop_clear:N \g_zhnum_cfg_map_var_prop + \prop_clear:N \g_zhnum_cfg_map_finan_prop + \file_input:n { zhnumber - #1 .cfg } + \zhnum_parse_config: \bool_if:nT { \cs_if_exist_p:N \CJK@makeInactive && \l_zhnum_set_CJK_active_bool } { \CJK@makeInactive } } +\cs_new_protected_nopar:Nn \zhnum_set_digits_map:nn + { \prop_put:Nnn \g_zhnum_cfg_map_prop {#1} {#2} } +\cs_new_protected_nopar:Nn \zhnum_set_digits_map:nnn + { + \prop_put_if_new:Nnn \g_zhnum_cfg_map_prop {#1} {#3} + \prop_put:Nnn \g_zhnum_cfg_map_var_prop {#1_#2} {#3} + } +\cs_new_protected_nopar:Nn \zhnum_set_financial_map:nn + { \prop_put:Nnn \g_zhnum_cfg_map_finan_prop {#1} {#2} } +\cs_new_protected_nopar:Nn \zhnum_set_financial_map:nnn + { + \prop_put_if_new:Nnn \g_zhnum_cfg_map_finan_prop {#1} {#3} + \prop_put:Nnn \g_zhnum_cfg_map_var_prop { financial_#1_#2 } {#3} + } +\prop_new:N \g_zhnum_cfg_map_prop +\prop_new:N \g_zhnum_cfg_map_var_prop +\prop_new:N \g_zhnum_cfg_map_finan_prop \keys_define:nn { zhnum / options } { - encoding .choice: , - encoding / UTF8 .code:n = { \bool_gset_false:N \g_zhnum_gbk_bool \zhnum_load_cfg: } , - encoding / GBK .code:n = { \bool_gset_true:N \g_zhnum_gbk_bool \zhnum_load_cfg: } , - encoding .default:n = { GBK } , + encoding .choice_code:n = + { + \tl_gset:Nx \c_zhnum_encoding_tl + { \exp_args:NV \tl_expandable_lowercase:n \l_keys_choice_tl } + \zhnum_load_cfg:n { \c_zhnum_encoding_tl } + } , + encoding .generate_choices:n = { UTF8 , GBK , Big5 } , + encoding .default:n = { GBK } , + encoding / Bg5 .meta:n = { encoding = Big5 } , + encoding / unknown .code:n = + { \msg_error:nnx { zhnumber } { encoding-invalid } { \l_keys_value_tl } } , style .multichoice: , - style / Normal .code:n = + style / Normal .code:n = { \bool_set_false:N \l_zhnum_ancient_bool \bool_set_true:N \l_zhnum_normal_bool } , - style / Financial .code:n = + style / Financial .code:n = { \bool_set_false:N \l_zhnum_ancient_bool \bool_set_false:N \l_zhnum_normal_bool } , - style / Ancient .code:n = + style / Ancient .code:n = { \bool_set_true:N \l_zhnum_ancient_bool \bool_set_true:N \l_zhnum_normal_bool } , - style / Simplified .code:n = { \bool_set_true:N \l_zhnum_simp_bool } , - style / Traditional .code:n = { \bool_set_false:N \l_zhnum_simp_bool } , - style .default:n = { Normal , Simplified } , - null .bool_set:N = \l_zhnum_null_bool , - reset .code:n = \zhnum_load_cfg: , - dot .tl_set:N = \c_zhnum_dot_tl , - and .tl_set:N = \c_zhnum_and_tl , - parts .tl_set:N = \c_zhnum_over_tl , - separator .tl_set:N = \c_zhnum_separator_tl , + style / Simplified .code:n = { \bool_set_true:N \l_zhnum_simp_bool } , + style / Traditional .code:n = { \bool_set_false:N \l_zhnum_simp_bool } , + style .default:n = { Normal , Simplified } , + null .bool_set:N = \l_zhnum_null_bool , + time .choice: , + time / Chinese .code:n = { \bool_set_true:N \l_zhnum_time_bool } , + time / Arabic .code:n = { \bool_set_false:N \l_zhnum_time_bool } , + time .default:n = { Arabic } , + reset .code:n = { \zhnum_load_cfg:n { \c_zhnum_encoding_tl } } , + } +\msg_new:nnn { zhnumber } { encoding-invalid } + { + The~encoding~'#1'~is~invalid,~please~check~it~over.\\\\ + Available~encoding~are~'UTF8',~'GBK'~and~'Big5'.\\ } \NewDocumentCommand \zhnumsetup { m } { \keys_set:nn { zhnum / options } {#1} \tex_ignorespaces:D } -\keys_set:nn { zhnum / options } { style , null = false , separator = {,} } +\keys_set:nn { zhnum / options } { style , time } \ProcessKeysOptions { zhnum / options } \ExplSyntaxOn -\bool_if_exist:NF \g_zhnum_gbk_bool +\tl_if_exist:NF \c_zhnum_encoding_tl { \exp_args:Nnx \keys_set:nn { zhnum / options } { @@ -438,7 +598,8 @@ %% zhnumber.sty, %% zhnumber-utf8.cfg, %% zhnumber-gbk.cfg, +%% zhnumber-big5.cfg, %% zhnumber.ins and -%% README.txt. +%% README. %% %% End of file `zhnumber.sty'. |