diff options
author | Karl Berry <karl@freefriends.org> | 2016-05-14 22:03:58 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-05-14 22:03:58 +0000 |
commit | 762dec7ad6e5083c542b5697ce206634feb3dd06 (patch) | |
tree | 98017462b3bac903e8133b04f697bba62187a487 /Master/texmf-dist/source/latex | |
parent | 8a897397d1ef31d60c60a663186a8a5c0be00aa2 (diff) |
zhnumber (14may16)
git-svn-id: svn://tug.org/texlive/trunk@41123 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx | 463 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/zhnumber/zhnumber.ins | 131 |
2 files changed, 246 insertions, 348 deletions
diff --git a/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx b/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx index 3fa1919271a..8a9fa8d53bf 100644 --- a/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx +++ b/Master/texmf-dist/source/latex/zhnumber/zhnumber.dtx @@ -4,77 +4,71 @@ \iffalse %</internal> %<*readme> -Introduction ------------- -The zhnumber package provides commands to typeset Chinese representations of -numbers. The main difference between this package and 'CJKnumb' is that commands +zhnumber +======== + +The `zhnumber` package provides commands to typeset Chinese representations of +numbers. The main difference between this package and `CJKnumb` is that commands provided by this package is expandable in the proper way. So, it seems that -zhnumber is a good alternative to CJKnumb package. +zhnumber is a good alternative to `CJKnumb` package. -It may be distributed and/or modified under the conditions of the -LaTeX Project Public License (LPPL), either version 1.3c of this license or -(at your option) any later version. The latest version of this license is in +Basic Usage +----------- +The package provides the following macros: - http://www.latex-project.org/lppl.txt + \zhnumber{<number>} -and version 1.3 or later is part of all distributions of LaTeX version -2005/12/01 or later. +Convert `<number>` to a full Chinese representation. -This work has the LPPL maintenance status "maintained". -The Current Maintainer of this work is Qing Lee. + \zhnum{<counter>} -This work 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 (this file). +Similar to `\arabic{<counter>}`, but representation of `<counter>` +as Chinese numerals. -Basic Usage ------------ -The package provides the following macros: + \zhdigits{<number>} + \zhdigits*{<number>} - \zhnumber{number} - Convert `number' to a full Chinese representation. +Handle `<number>` as a string of digits and convert each of them into the +corresponding Chinese digit. The starred version uses the Chinese circle glyph +for digit zero; the unstarred version uses the traditional glyph. - \zhnum{counter} - Similar to \arabic{counter}, but representation of 'counter' as Chinese numerals. +You can read the package manual (in Chinese) for more detailed explanations. - \zhdigits{number} - \zhdigits*{number} - Handle `number' as a string of digits and convert each of them into the - corresponding Chinese digit. The starred version uses the Chinese circle glyph - for digit zero; the unstarred version uses the traditional glyph. +Contributing +------------ -You can read the package manual (in Chinese) for more detailed explanations. +This package is a part of the [ctex-kit](https://github.com/CTeX-org/ctex-kit) project. -Author ------- -Qing Lee -Email: sobenlee@gmail.com +Issues and pull requests are welcome. -If you are interested in the process of development you may observe +Copyright and Licence +--------------------- - https://github.com/CTeX-org/ctex-kit + Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> + ---------------------------------------------------------------------- -Installation ------------- -The package is supplied in dtx format and as a pre-extracted zip file, -zhnumber.tds.zip. The later is most convenient for most users: simply -unzip this in your local texmf directory and run texhash to update the -database of file locations. If you want to unpack the dtx yourself, -running "xetex zhnumber.dtx" will extract the package whereas -"xelatex zhnumber.dtx" will typeset the documentation. + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and 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 package requires LaTeX3 support as provided in the l3kernel and l3packages -bundles. Both of these are available on CTAN as ready-to-install zip files. -Suitable versions are available in the latest version of MiKTeX and TeX Live -(updating the relevant packages online may be necessary). + The Current Maintainer of this work is Qing Lee. -To compile the documentation without error, you will need the xeCJK package -and some specific Chinese Simplified fonts (TrueType or OpenType). + 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.md (this file). %</readme> %<*internal> \fi @@ -85,81 +79,50 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). %</internal> %<*install> -\newread\inputcheck -\openin\inputcheck=zhnumber.ver -\ifeof\inputcheck - \def\zhnumberPutVersion{\string\GetIdInfo$Id$} -\else - \input zhnumber.ver -\fi -\closein\inputcheck - -\input l3docstrip.tex - -\def\checkOption<#1{% - \ifcase - \ifx*#10\else \ifx/#11\else - \ifx+#12\else \ifx-#13\else - \ifx<#14\else \ifx @#15\else - \ifx.#16\else - 7\fi\fi\fi\fi\fi\fi\fi\relax - \expandafter\starOption\or - \expandafter\slashOption\or - \expandafter\plusOption\or - \expandafter\minusOption\or - \expandafter\verbOption\or - \expandafter\moduleOption\or - \expandafter\expOption\or - \expandafter\doOption\fi - #1% -} -\def\expOption .#1>#2\endLine{% - \maybeMsg{<.#1 . >}% - \Evaluate{#1}% - \begingroup - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\ =10 - \xdef\expandedLineStuff{\scantokens{#2\noexpand}}% - \endgroup - \def\do##1##2##3{% - \if1\Expr{##2}\StreamPut##1{\expandedLineStuff}\fi - }% - \activefiles -} +\input ctxdocstrip % -\keepsilent -\askforoverwritefalse \preamble - Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2012, 2014-2016 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. + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and 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. + +-------------------------------------------------------------------------- \endpreamble \postamble - 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. + 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.md. \endpostamble \generate { +%</install> +%<*internal> \usedir{source/latex/zhnumber} \file{zhnumber.ins} {\from{\jobname.dtx}{install}} +%</internal> +%<*install> \usedir{tex/latex/zhnumber} \file{zhnumber.sty} {\from{\jobname.dtx}{package}} \usedir{tex/latex/zhnumber/config} @@ -168,7 +131,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). \file{zhnumber-gbk.cfg} {\from{\jobname.dtx}{config,gbk}} \nopreamble\nopostamble \usedir{doc/latex/zhnumber} - \file{README.txt} {\from{\jobname.dtx}{readme}} + \file{README.md} {\from{\jobname.dtx}{readme}} } \endbatchfile @@ -176,153 +139,42 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). %<*internal> \fi %</internal> -% -%<*driver|package|config> -%<*!config> -\NeedsTeXFormat{LaTeX2e} -\RequirePackage{expl3} -%</!config> -%<.!driver>\zhnumberPutVersion -%<*driver> -\InputIfFileExists{zhnumber.ver}{}{ - \def\zhnumberGetVersionInfo{\GetIdInfo$Id$}} -\zhnumberGetVersionInfo - {zhnumber source file} -\ProvidesExplFile{\ExplFileName.\ExplFileExtension} -%</driver> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\RequirePackage{expl3} +%<+package|config>\GetIdInfo$Id$ %<package> {Typesetting numbers with Chinese glyphs} %<config&utf8> {Chinese numerals with UTF8 encoding} %<config&big5> {Chinese numerals with Big5 encoding} %<config&gbk> {Chinese numerals with GBK encoding} -%<package>\ProvidesExplPackage -%<config>\ProvidesExplFile -%<package> {\ExplFileName} -%<config&utf8> {\ExplFileName-utf8.cfg} -%<config&big5> {\ExplFileName-big5.cfg} -%<config&gbk> {\ExplFileName-gbk.cfg} - {\ExplFileDate}{2.3}{\ExplFileDescription} -%</driver|package|config> +%<package>\ProvidesExplPackage{\ExplFileName} +%<config&utf8>\ProvidesExplFile{\ExplFileName-utf8.cfg} +%<config&big5>\ProvidesExplFile{\ExplFileName-big5.cfg} +%<config&gbk>\ProvidesExplFile{\ExplFileName-gbk.cfg} +%<package|config> {\ExplFileDate}{2.4}{\ExplFileDescription} %<*driver> -\ExplSyntaxOff -\let\ctexrevnum\ExplFileVersion -\expandafter\let\csname ver@thumbpdf.sty\endcsname\fmtversion -\documentclass[numbered,full,a4paper]{l3doc} -\usepackage{amsmath} -\usepackage{xeCJK} -\usepackage{zhnumber} -\usepackage{fvrb-ex} -\usepackage{indentfirst} -\usepackage{geometry} -\geometry{includemp,hmargin={0mm,15mm},vmargin=15mm,footskip=7mm} -\BeforeBeginEnvironment{SideBySideExample}{\vskip1ex\relax} -\hypersetup{pdfstartview=FitH} -\setlist{noitemsep,topsep=\smallskipamount} -\linespread{1.1} -\setmainfont{TeX Gyre Pagella} -\setsansfont{CMU Sans Serif} -\setmonofont[ - UprightFont=* Light, BoldFont=* Bold, - SlantedFont=* Light Oblique]{CMU Typewriter Text} -\xeCJKDeclareCharClass{CJK}{ "25CB } -\setCJKmainfont[BoldFont=Adobe Heiti Std,ItalicFont=Adobe Kaiti Std]{Adobe Song Std} -\setCJKmonofont{Adobe Kaiti Std} -\xeCJKsetup{PunctStyle=kaiming} -\def\ctexkitrev#1{% - \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}} -\makeatletter -\def\LaTeX{\hologo{LaTeX}} -\def\upTeX{up\!\hologo{TeX}} -\def\upLaTeX{up\hologo{LaTeX}} -\def\pdfLaTeX{\hologo{pdfLaTeX}} -\def\LuaLaTeX{\hologo{LuaLaTeX}} -\def\XeLaTeX{\hologo{XeLaTeX}} -\def\TF{true\orbar false} -\def\TTF{\defaultval{true}\orbar false} -\def\TFF{true\orbar\defaultval{false}} -\def\defaultval#1{\textbf{\textup{#1}}} -\def\defaultvalaux#1){\defaultval{#1}} -\def\orbar{\textup{\textbar}} -\preto\MacroFont{\linespread{1}} -\appto\MacroFont{\hyphenchar\font\m@ne} -\preto\AltMacroFont{\linespread{1}} -\appto\AltMacroFont{\hyphenchar\font\m@ne} -\ExplSyntaxOn -\cs_set_protected:Npn \__codedoc_special_index_aux:nnnnn #1#2#3#4#5 - { - \__codedoc_special_index_set:Nn \l__codedoc_index_escaped_macro_tl {#2} - \str_if_eq:onTF { \@currenvir } { macrocode } - { \codeline@wrindex } - { - \HD@target - \index - } - { - \tl_if_empty:nF { #3 #4 } - { #3 \actualchar #4 \levelchar } - #1 - \actualchar - { - \token_to_str:N \verbatim@font \c_space_tl - \l__codedoc_index_escaped_macro_tl - } - \encapchar - hdclindex{\the\c@HD@hypercount}{#5} - } - } -\DeclareDocumentCommand \cs { O{} m } - { \__codedoc_cmd_aux:no {#1} { \c__codedoc_backslash_tl #2 } } -\DeclareDocumentCommand \tn { O{} m } - { - \__codedoc_cmd_aux:no - { index = TeX , replace = false , #1 } - { \c__codedoc_backslash_tl #2 } - } -\DeclareDocumentCommand \meta { +m } - { \__codedoc_meta_aux:n {#1} } -\DeclareExpandableDocumentCommand \bookmarkcstn { O{} m } - { \tl_to_str:n {#2} } -\cs_new:Npn \bookmarkmeta #1 { < \tl_to_str:n {#1} > } -\cs_generate_variant:Nn \__codedoc_cmd_aux:nn { no } -\AtBeginEnvironment { syntax } - { - \char_set_active_eq:NN \| \orbar - \char_set_active_eq:NN \( \defaultvalaux - } -\ExplSyntaxOff -\makeatother -\pdfstringdefDisableCommands{% - \let\cs\bookmarkcstn - \let\tn\bookmarkcstn - \let\meta\bookmarkmeta - \let\path\detokenize} -\def\indexname{代码索引} -\IndexPrologue{% - \section*{\indexname} - \markboth{\indexname}{\indexname} - 斜体的数字表示对应项说明所在的页码,下划线的数字表示定义所在的代码行号,而直立体的 - 数字表示对应项使用时所在的行号。} +\documentclass{ctxdoc} \begin{document} \DocInput{\jobname.dtx} - \newgeometry{margin=15mm,footskip=7mm} + \IndexLayout \PrintIndex \end{document} %</driver> % \fi % -% \CheckSum{1193} -% \GetFileInfo{\jobname.sty} +% \CheckSum{1219} +% \GetFileId{zhnumber.sty} % % \title{\bfseries\pkg{zhnumber} 宏包} % \author{李清\\ \path{sobenlee@gmail.com}} -% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ctexrevnum}.}} +% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ExplFileVersion}.}} % \maketitle % % \begin{documentation} % % \section{简介} % \pkg{zhnumber} 宏包用于将阿拉伯数字按照中文格式输出。相比于 \pkg{CJKnumb},它提供 -% 的三个格式转换命令 \tn{zhnumber},\tn{zhdigits} 和 \tn{zhnum} 都是可以适当展开的, -% 可以正常使用于 |PDF| 书签和交叉引用。 +% 的四个格式转换命令 \tn{zhnumber},\tn{zhdigits}、\tn{zhnum} 和 \tn{zhdig} +% 都是可以适当展开的,可以正常使用于 |PDF| 书签和交叉引用。 % % \pkg{zhnumber} 支持 |GBK|,|Big5| 和 |UTF8| 编码,依赖 \hologo{LaTeX3} 项目的 % \pkg{expl3},\pkg{xparse} 和 \pkg{l3keys2e} 宏包。 @@ -371,9 +223,10 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \end{SideBySideExample} % \end{function} % -% \begin{function}[rEXP, updated=2014-09-09]{\zhnum} +% \begin{function}[rEXP, updated=2016-05-01]{\zhnum} % \begin{syntax} % \tn{zhnum} \Arg{counter} +% \tn{pagenumbering} \{zhnum\} % \end{syntax} % 与 |\roman| 等类似,用于将 \LaTeX 计数器的值转换为中文数字。例如 % \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5] @@ -381,6 +234,17 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \end{SideBySideExample} % \end{function} % +% \begin{function}[rEXP, added=2016-05-01]{\zhdig} +% \begin{syntax} +% \tn{zhdig} \Arg{counter} +% \tn{pagenumbering} \{zhdig\} +% \end{syntax} +% 与 |\roman| 等类似,用于将 \LaTeX 计数器的值转换为中文数字串。例如 +% \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5] +% \zhdig{section} +% \end{SideBySideExample} +% \end{function} +% % \begin{function}[rEXP, added=2012-05-25]{\zhweekday} % \begin{syntax} % \tn{zhweekday} \Arg{yyyy/mm/dd} @@ -501,6 +365,13 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \end{SideBySideExample} % \end{function} % +% \begin{function}[added=2016-05-01]{arabicsep} +% \begin{syntax} +% arabicsep = \Arg{sep} +% \end{syntax} +% 设置日期和时间的数字格式为阿拉伯数字时,阿拉伯数字与汉字的间隔内容。默认为一个空格。 +% \end{function} +% % \begin{function}[updated=2012-05-25]{style} % \begin{syntax} % style = <(Simplified)|Traditional|(Normal)|Financial|Ancient> @@ -592,11 +463,12 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % 才会有效果。 % \end{function} % -% \begin{function}[updated=2014-09-09]{\zhnumber,\zhdigits,\zhnum} +% \begin{function}[updated=2016-05-01]{\zhnumber,\zhdigits,\zhnum,\zhdig} % \begin{syntax} % \tn{zhnumber} \oarg{options} \Arg{number} % \tn{zhdigits} * \oarg{options} \Arg{number} % \tn{zhnum} \oarg{options} \Arg{counter} +% \tn{zhdig} \oarg{options} \Arg{counter} % \end{syntax} % 如果只改变当前数字的中文输出格式,可以使用带选项的格式转换命令,其中 \meta{options} % 与 \tn{zhnumsetup} 的参数相同,如上所介绍。这些带了选项的命令是不可展开的,在某些场合使 @@ -790,6 +662,13 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\@zhnum} +% 用于支持 |\pagenumbering{zhnum}|。 +% \begin{macrocode} +\cs_new_nopar:Npn \@zhnum { \zhnum_int:n } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\zhnum_integer:n} % 对整数的处理。这个函数基本抄录自 \pkg{l3bigint} 的 \cs{__bingint_read_do:nn}。它可以 % 正确取得符号,去掉多余的零,还可以循环展开数字。但它在遇到非数字的时候就停止了 @@ -1000,6 +879,39 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \end{macrocode} % \end{macro} % +% \begin{macro}{\zhdig} +% 用于将 \LaTeX{} 计数器按中文数字串输出。 +% \begin{macrocode} +\DeclareExpandableDocumentCommand \zhdig { +o +m } + { + \IfNoValueTF {#1} + { \zhnum_digits_counter:n } + { \zhdigwithoptions {#1} } + {#2} + } +\NewDocumentCommand \zhdigwithoptions { +m +m } + { + \group_begin: + \keys_set:nn { zhnum / options } {#1} + \zhnum_digits_counter:n #1 {#2} + \group_end: + } +\cs_new:Npn \zhnum_digits_counter:n #1 + { + \int_if_exist:cTF { c@#1 } + { \zhnum_digits_null:v { c@#1 } } + { \@@_counter_error:n {#1} } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\@zhdig} +% 用于支持 |\pagenumbering{zhdig}|。 +% \begin{macrocode} +\cs_new_nopar:Npn \@zhdig #1 { \zhnum_digits_null:f { \int_eval:n {#1} } } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\zhdigits,\zhdigitswithoptions} % 将输入的数字输出为中文数字串输出。 % \begin{macrocode} @@ -1027,7 +939,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \zhnum_digits:Nn \BooleanTrue } \cs_new_nopar:Npn \zhnum_digits_null:n { \zhnum_digits:Nn \BooleanFalse } -\cs_generate_variant:Nn \zhnum_digits_null:n { V } +\cs_generate_variant:Nn \zhnum_digits_null:n { V , v , f } % \end{macrocode} % \end{macro} % @@ -1095,11 +1007,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \@@_week_day:www #2 \q_stop } } \cs_new:Npn \@@_date:www #1/#2/#3 \q_stop - { - \zhnum_check_time:Nn \zhnum_digits_null:n {#1} \c_@@_year_tl - \zhnum_check_time:Nn \zhnum_int:n {#2} \c_@@_month_tl - \zhnum_check_time:Nn \zhnum_int:n {#3} \c_@@_day_tl - } + { \@@_date_aux:nnn {#1} {#2} {#3} } % \end{macrocode} % \end{macro} % @@ -1107,19 +1015,27 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % 输出当天日期。 % \begin{macrocode} \cs_new_nopar:Npn \zhtoday - { - \zhnum_check_time:Nn \zhnum_digits_null:V \tex_year:D \c_@@_year_tl - \zhnum_check_time:Nn \zhnum_int:n \tex_month:D \c_@@_month_tl - \zhnum_check_time:Nn \zhnum_int:n \tex_day:D \c_@@_day_tl - } + { \@@_date_aux:Vnn \tex_year:D \tex_month:D \tex_day:D } % \end{macrocode} % \end{macro} % -% \begin{macro}[internal]{\zhnum_check_time:Nn} -% 判断是用中文数字还是用阿拉伯数组。 +% \begin{macro}{\@@_date_aux:nnn} % \begin{macrocode} -\cs_new:Npn \zhnum_check_time:Nn #1 - { \bool_if:NTF \l_@@_time_bool {#1} { \int_to_arabic:n } } +\cs_new_nopar:Npn \@@_date_aux:nnn + { + \bool_if:NTF \l_@@_time_bool + { \@@_date_aux:NNnnnn \zhnum_digits_null:n \zhnum_int:n { } } + { \@@_date_aux:Nnnnn \int_to_arabic:n { \l_@@_arabic_sep_tl } } + } +\cs_new:Npn \@@_date_aux:Nnnnn #1 + { \@@_date_aux:NNnnnn #1#1 } +\cs_new:Npn \@@_date_aux:NNnnnn #1#2#3#4#5#6 + { + #1 {#4} #3 \c_@@_year_tl #3 + #2 {#5} #3 \c_@@_month_tl #3 + #2 {#6} #3 \c_@@_day_tl + } +\cs_generate_variant:Nn \@@_date_aux:nnn { V } % \end{macrocode} % \end{macro} % @@ -1231,10 +1147,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). { \cs_new:Npn \exp_not:N \@@_time:ww ##1 \c_colon_str ##2 \exp_not:N \q_stop } - { - \zhnum_check_time:Nn \zhnum_int:n {#1} \c_@@_hour_tl - \zhnum_check_time:Nn \zhnum_int:n {#2} \c_@@_minute_tl - } + { \@@_time_aux:nn {#1} {#2} } % \end{macrocode} % \end{macro} % @@ -1243,10 +1156,25 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % \begin{macrocode} \cs_new_nopar:Npn \zhcurrtime { - \zhnum_check_time:Nn \zhnum_int:n - { \int_div_truncate:nn \tex_time:D { 60 } } \c_@@_hour_tl - \zhnum_check_time:Nn \zhnum_int:n - { \int_mod:nn \tex_time:D { 60 } } \c_@@_minute_tl + \@@_time_aux:nn + { \int_div_truncate:nn \tex_time:D { 60 } } + { \int_mod:nn \tex_time:D { 60 } } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\@@_time_aux:nn,\@@_time_aux:Nnnn} +% \begin{macrocode} +\cs_new_nopar:Npn \@@_time_aux:nn + { + \bool_if:NTF \l_@@_time_bool + { \@@_time_aux:Nnnn \zhnum_int:n { } } + { \@@_time_aux:Nnnn \int_to_arabic:n { \l_@@_arabic_sep_tl } } + } +\cs_new:Npn \@@_time_aux:Nnnn #1#2#3#4 + { + #1 {#3} #2 \c_@@_hour_tl #2 + #1 {#4} #2 \c_@@_minute_tl } % \end{macrocode} % \end{macro} @@ -1834,6 +1762,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). ganzhi-cyclic / false.code:n = { \cs_set_eq:NN \zhnum_ganzhi:nnn \zhnum_ganzhi_normal:nnn } , ganzhi-cyclic .default:n = { true } , + arabicsep .tl_set:N = \l_@@_arabic_sep_tl } \str_new:N \l_@@_encoding_str \msg_new:nnnn { zhnumber } { encoding-invalid } @@ -1855,7 +1784,7 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % % 初始化设置和执行宏包选项。 % \begin{macrocode} -\keys_set:nn { zhnum / options } { style , time } +\keys_set:nn { zhnum / options } { style , time , arabicsep = { ~ } } \ProcessKeysOptions { zhnum / options } % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins b/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins index 4aadc96b646..42ac251c79f 100644 --- a/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins +++ b/Master/texmf-dist/source/latex/zhnumber/zhnumber.ins @@ -6,95 +6,64 @@ %% %% zhnumber.dtx (with options: `install') %% -%% Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> +%% Copyright (C) 2012, 2014-2016 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. +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and 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. +%% +%% -------------------------------------------------------------------------- %% -\newread\inputcheck -\openin\inputcheck=zhnumber.ver -\ifeof\inputcheck - \def\zhnumberPutVersion{\string\GetIdInfo$Id$} -\else - \input zhnumber.ver -\fi -\closein\inputcheck - -\input l3docstrip.tex - -\def\checkOption<#1{% - \ifcase - \ifx*#10\else \ifx/#11\else - \ifx+#12\else \ifx-#13\else - \ifx<#14\else \ifx @#15\else - \ifx.#16\else - 7\fi\fi\fi\fi\fi\fi\fi\relax - \expandafter\starOption\or - \expandafter\slashOption\or - \expandafter\plusOption\or - \expandafter\minusOption\or - \expandafter\verbOption\or - \expandafter\moduleOption\or - \expandafter\expOption\or - \expandafter\doOption\fi - #1% -} -\def\expOption .#1>#2\endLine{% - \maybeMsg{<.#1 . >}% - \Evaluate{#1}% - \begingroup - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\ =10 - \xdef\expandedLineStuff{\scantokens{#2\noexpand}}% - \endgroup - \def\do##1##2##3{% - \if1\Expr{##2}\StreamPut##1{\expandedLineStuff}\fi - }% - \activefiles -} +\input ctxdocstrip % -\keepsilent -\askforoverwritefalse \preamble - Copyright (C) 2012, 2014-2016 by Qing Lee <sobenlee@gmail.com> + Copyright (C) 2012, 2014-2016 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. + This work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt + and 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. + +-------------------------------------------------------------------------- \endpreamble \postamble - 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. + 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.md. \endpostamble \generate { - \usedir{source/latex/zhnumber} - \file{zhnumber.ins} {\from{\jobname.dtx}{install}} \usedir{tex/latex/zhnumber} \file{zhnumber.sty} {\from{\jobname.dtx}{package}} \usedir{tex/latex/zhnumber/config} @@ -103,18 +72,18 @@ \file{zhnumber-gbk.cfg} {\from{\jobname.dtx}{config,gbk}} \nopreamble\nopostamble \usedir{doc/latex/zhnumber} - \file{README.txt} {\from{\jobname.dtx}{readme}} + \file{README.md} {\from{\jobname.dtx}{readme}} } \endbatchfile %% -%% 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. +%% 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.md. %% %% End of file `zhnumber.ins'. |