From 762dec7ad6e5083c542b5697ce206634feb3dd06 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 14 May 2016 22:03:58 +0000 Subject: zhnumber (14may16) git-svn-id: svn://tug.org/texlive/trunk@41123 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/zhnumber/README | 71 ---- Master/texmf-dist/doc/latex/zhnumber/README.md | 65 +++ Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf | Bin 325428 -> 290451 bytes .../texmf-dist/source/latex/zhnumber/zhnumber.dtx | 463 +++++++++------------ .../texmf-dist/source/latex/zhnumber/zhnumber.ins | 131 +++--- .../tex/latex/zhnumber/zhnumber-big5.cfg | 49 ++- .../texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg | 49 ++- .../tex/latex/zhnumber/zhnumber-utf8.cfg | 49 ++- Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty | 120 ++++-- 9 files changed, 472 insertions(+), 525 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/zhnumber/README create mode 100644 Master/texmf-dist/doc/latex/zhnumber/README.md diff --git a/Master/texmf-dist/doc/latex/zhnumber/README b/Master/texmf-dist/doc/latex/zhnumber/README deleted file mode 100644 index 211fbb922d0..00000000000 --- a/Master/texmf-dist/doc/latex/zhnumber/README +++ /dev/null @@ -1,71 +0,0 @@ -Introduction ------------- -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. - -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 - - 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 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). - -Basic Usage ------------ -The package provides the following macros: - - \zhnumber{number} - Convert `number' to a full Chinese representation. - - \zhnum{counter} - Similar to \arabic{counter}, but representation of 'counter' as Chinese numerals. - - \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. - -You can read the package manual (in Chinese) for more detailed explanations. - -Author ------- -Qing Lee -Email: sobenlee@gmail.com - -If you are interested in the process of development you may observe - - https://github.com/CTeX-org/ctex-kit - -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. - -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). - -To compile the documentation without error, you will need the xeCJK package -and some specific Chinese Simplified fonts (TrueType or OpenType). diff --git a/Master/texmf-dist/doc/latex/zhnumber/README.md b/Master/texmf-dist/doc/latex/zhnumber/README.md new file mode 100644 index 00000000000..5304e7eef81 --- /dev/null +++ b/Master/texmf-dist/doc/latex/zhnumber/README.md @@ -0,0 +1,65 @@ +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. + +Basic Usage +----------- +The package provides the following macros: + + \zhnumber{} + +Convert `` to a full Chinese representation. + + \zhnum{} + +Similar to `\arabic{}`, but representation of `` +as Chinese numerals. + + \zhdigits{} + \zhdigits*{} + +Handle `` 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. + +You can read the package manual (in Chinese) for more detailed explanations. + +Contributing +------------ + +This package is a part of the [ctex-kit](https://github.com/CTeX-org/ctex-kit) project. + +Issues and pull requests are welcome. + +Copyright and Licence +--------------------- + + Copyright (C) 2012, 2014-2016 by 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. + + 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). diff --git a/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf b/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf index 65289a9c2eb..c65011bcacc 100644 Binary files a/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf and b/Master/texmf-dist/doc/latex/zhnumber/zhnumber.pdf differ 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 % %<*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{} -and version 1.3 or later is part of all distributions of LaTeX version -2005/12/01 or later. +Convert `` to a full Chinese representation. -This work has the LPPL maintenance status "maintained". -The Current Maintainer of this work is Qing Lee. + \zhnum{} -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{}`, but representation of `` +as Chinese numerals. -Basic Usage ------------ -The package provides the following macros: + \zhdigits{} + \zhdigits*{} - \zhnumber{number} - Convert `number' to a full Chinese representation. +Handle `` 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 + ---------------------------------------------------------------------- -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). % %<*internal> \fi @@ -85,81 +79,50 @@ and some specific Chinese Simplified fonts (TrueType or OpenType). % %<*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 + Copyright (C) 2012, 2014-2016 by Qing Lee -------------------------------------------------------------------------- - 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 { +% +%<*internal> \usedir{source/latex/zhnumber} \file{zhnumber.ins} {\from{\jobname.dtx}{install}} +% +%<*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 % -% -%<*driver|package|config> -%<*!config> -\NeedsTeXFormat{LaTeX2e} -\RequirePackage{expl3} -% -%<.!driver>\zhnumberPutVersion -%<*driver> -\InputIfFileExists{zhnumber.ver}{}{ - \def\zhnumberGetVersionInfo{\GetIdInfo$Id$}} -\zhnumberGetVersionInfo - {zhnumber source file} -\ProvidesExplFile{\ExplFileName.\ExplFileExtension} -% +%\NeedsTeXFormat{LaTeX2e} +%\RequirePackage{expl3} +%<+package|config>\GetIdInfo$Id$ % {Typesetting numbers with Chinese glyphs} % {Chinese numerals with UTF8 encoding} % {Chinese numerals with Big5 encoding} % {Chinese numerals with GBK encoding} -%\ProvidesExplPackage -%\ProvidesExplFile -% {\ExplFileName} -% {\ExplFileName-utf8.cfg} -% {\ExplFileName-big5.cfg} -% {\ExplFileName-gbk.cfg} - {\ExplFileDate}{2.3}{\ExplFileDescription} -% +%\ProvidesExplPackage{\ExplFileName} +%\ProvidesExplFile{\ExplFileName-utf8.cfg} +%\ProvidesExplFile{\ExplFileName-big5.cfg} +%\ProvidesExplFile{\ExplFileName-gbk.cfg} +% {\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} % % \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 +%% Copyright (C) 2012, 2014-2016 by Qing Lee %% -------------------------------------------------------------------------- -%% 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 + Copyright (C) 2012, 2014-2016 by Qing Lee -------------------------------------------------------------------------- - 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'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg index f62be008da2..e215fbf1aa0 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-big5.cfg @@ -6,24 +6,29 @@ %% %% zhnumber.dtx (with options: `config,big5') %% -%% Copyright (C) 2012, 2014-2016 by Qing Lee +%% Copyright (C) 2012, 2014-2016 by Qing Lee %% -------------------------------------------------------------------------- -%% 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. %% -\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee $ +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Qing Lee. +%% +%% -------------------------------------------------------------------------- +%% +\GetIdInfo$Id: zhnumber.dtx e19bfb4 2016-05-14 12:23:34 +0800 Qing Lee $ {Chinese numerals with Big5 encoding} -\ProvidesExplFile - {\ExplFileName-big5.cfg} - {\ExplFileDate}{2.3}{\ExplFileDescription} +\ProvidesExplFile{\ExplFileName-big5.cfg} + {\ExplFileDate}{2.4}{\ExplFileDescription} \zhnum_set_digits_map:nn { minus } { t } \zhnum_set_digits_map:nn { 0 } { s } \zhnum_set_digits_map:nn { null } { } @@ -100,13 +105,13 @@ \zhnum_set_dizhi_map:nn { 11 } { } \zhnum_set_dizhi_map:nn { 12 } { } %% -%% 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-big5.cfg'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg index 57e1af8dbf9..c0b35fdd2d6 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-gbk.cfg @@ -6,24 +6,29 @@ %% %% zhnumber.dtx (with options: `config,gbk') %% -%% Copyright (C) 2012, 2014-2016 by Qing Lee +%% Copyright (C) 2012, 2014-2016 by Qing Lee %% -------------------------------------------------------------------------- -%% 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. %% -\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee $ +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Qing Lee. +%% +%% -------------------------------------------------------------------------- +%% +\GetIdInfo$Id: zhnumber.dtx e19bfb4 2016-05-14 12:23:34 +0800 Qing Lee $ {Chinese numerals with GBK encoding} -\ProvidesExplFile - {\ExplFileName-gbk.cfg} - {\ExplFileDate}{2.3}{\ExplFileDescription} +\ProvidesExplFile{\ExplFileName-gbk.cfg} + {\ExplFileDate}{2.4}{\ExplFileDescription} \zhnum_set_digits_map:nnn { minus } { simp } { } \zhnum_set_digits_map:nnn { minus } { trad } { ؓ } \zhnum_set_digits_map:nn { 0 } { } @@ -110,13 +115,13 @@ \zhnum_set_dizhi_map:nn { 11 } { } \zhnum_set_dizhi_map:nn { 12 } { } %% -%% 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-gbk.cfg'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg index d8f110df755..59c223f1323 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg @@ -6,24 +6,29 @@ %% %% zhnumber.dtx (with options: `config,utf8') %% -%% Copyright (C) 2012, 2014-2016 by Qing Lee +%% Copyright (C) 2012, 2014-2016 by Qing Lee %% -------------------------------------------------------------------------- -%% 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. %% -\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee $ +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Qing Lee. +%% +%% -------------------------------------------------------------------------- +%% +\GetIdInfo$Id: zhnumber.dtx e19bfb4 2016-05-14 12:23:34 +0800 Qing Lee $ {Chinese numerals with UTF8 encoding} -\ProvidesExplFile - {\ExplFileName-utf8.cfg} - {\ExplFileDate}{2.3}{\ExplFileDescription} +\ProvidesExplFile{\ExplFileName-utf8.cfg} + {\ExplFileDate}{2.4}{\ExplFileDescription} \zhnum_set_digits_map:nnn { minus } { simp } { 负 } \zhnum_set_digits_map:nnn { minus } { trad } { 負 } \zhnum_set_digits_map:nn { 0 } { 零 } @@ -110,13 +115,13 @@ \zhnum_set_dizhi_map:nn { 11 } { 戌 } \zhnum_set_dizhi_map:nn { 12 } { 亥 } %% -%% 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-utf8.cfg'. diff --git a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty index 3945d1cfc98..9a7b55f861c 100644 --- a/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty +++ b/Master/texmf-dist/tex/latex/zhnumber/zhnumber.sty @@ -6,26 +6,31 @@ %% %% zhnumber.dtx (with options: `package') %% -%% Copyright (C) 2012, 2014-2016 by Qing Lee +%% Copyright (C) 2012, 2014-2016 by Qing Lee %% -------------------------------------------------------------------------- -%% 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. +%% +%% -------------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: zhnumber.dtx 9686fd1 2016-02-02 16:55:41 +0800 Qing Lee $ +\GetIdInfo$Id: zhnumber.dtx e19bfb4 2016-05-14 12:23:34 +0800 Qing Lee $ {Typesetting numbers with Chinese glyphs} -\ProvidesExplPackage - {\ExplFileName} - {\ExplFileDate}{2.3}{\ExplFileDescription} +\ProvidesExplPackage{\ExplFileName} + {\ExplFileDate}{2.4}{\ExplFileDescription} \msg_new:nnn { zhnumber } { l3-too-old } { Support~package~'expl3'~too~old. \\\\ @@ -135,6 +140,7 @@ } } \cs_generate_variant:Nn \zhnum_int:n { c } +\cs_new_nopar:Npn \@zhnum { \zhnum_int:n } \cs_new:Npn \zhnum_integer:n #1 { \exp_after:wN \__zhnum_read_integer:www @@ -282,6 +288,27 @@ } \int_compare:nNnF {#4} = \c_zero { \zhnum_digit_map:n {#4} } } +\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 } } + { \__zhnum_counter_error:n {#1} } + } +\cs_new_nopar:Npn \@zhdig #1 { \zhnum_digits_null:f { \int_eval:n {#1} } } \DeclareExpandableDocumentCommand \zhdigits { +s +o +m } { \IfNoValueTF {#2} @@ -300,7 +327,7 @@ { \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 } \cs_new:Npn \zhnum_digits:Nn #1#2 { \exp_after:wN \__zhnum_read_digits:w @@ -356,19 +383,24 @@ { \__zhnum_week_day:www #2 \q_stop } } \cs_new:Npn \__zhnum_date:www #1/#2/#3 \q_stop + { \__zhnum_date_aux:nnn {#1} {#2} {#3} } +\cs_new_nopar:Npn \zhtoday + { \__zhnum_date_aux:Vnn \tex_year:D \tex_month:D \tex_day:D } +\cs_new_nopar:Npn \__zhnum_date_aux:nnn { - \zhnum_check_time:Nn \zhnum_digits_null:n {#1} \c__zhnum_year_tl - \zhnum_check_time:Nn \zhnum_int:n {#2} \c__zhnum_month_tl - \zhnum_check_time:Nn \zhnum_int:n {#3} \c__zhnum_day_tl + \bool_if:NTF \l__zhnum_time_bool + { \__zhnum_date_aux:NNnnnn \zhnum_digits_null:n \zhnum_int:n { } } + { \__zhnum_date_aux:Nnnnn \int_to_arabic:n { \l__zhnum_arabic_sep_tl } } } -\cs_new_nopar:Npn \zhtoday +\cs_new:Npn \__zhnum_date_aux:Nnnnn #1 + { \__zhnum_date_aux:NNnnnn #1#1 } +\cs_new:Npn \__zhnum_date_aux:NNnnnn #1#2#3#4#5#6 { - \zhnum_check_time:Nn \zhnum_digits_null:V \tex_year:D \c__zhnum_year_tl - \zhnum_check_time:Nn \zhnum_int:n \tex_month:D \c__zhnum_month_tl - \zhnum_check_time:Nn \zhnum_int:n \tex_day:D \c__zhnum_day_tl + #1 {#4} #3 \c__zhnum_year_tl #3 + #2 {#5} #3 \c__zhnum_month_tl #3 + #2 {#6} #3 \c__zhnum_day_tl } -\cs_new:Npn \zhnum_check_time:Nn #1 - { \bool_if:NTF \l__zhnum_time_bool {#1} { \int_to_arabic:n } } +\cs_generate_variant:Nn \__zhnum_date_aux:nnn { V } \cs_new:Npn \zhweekday #1 { \__zhnum_week_day:www #1 \q_stop } \cs_new:Npn \__zhnum_week_day:www #1/#2/#3 \q_stop @@ -433,16 +465,23 @@ { \cs_new:Npn \exp_not:N \__zhnum_time:ww ##1 \c_colon_str ##2 \exp_not:N \q_stop } + { \__zhnum_time_aux:nn {#1} {#2} } +\cs_new_nopar:Npn \zhcurrtime { - \zhnum_check_time:Nn \zhnum_int:n {#1} \c__zhnum_hour_tl - \zhnum_check_time:Nn \zhnum_int:n {#2} \c__zhnum_minute_tl + \__zhnum_time_aux:nn + { \int_div_truncate:nn \tex_time:D { 60 } } + { \int_mod:nn \tex_time:D { 60 } } } -\cs_new_nopar:Npn \zhcurrtime +\cs_new_nopar:Npn \__zhnum_time_aux:nn + { + \bool_if:NTF \l__zhnum_time_bool + { \__zhnum_time_aux:Nnnn \zhnum_int:n { } } + { \__zhnum_time_aux:Nnnn \int_to_arabic:n { \l__zhnum_arabic_sep_tl } } + } +\cs_new:Npn \__zhnum_time_aux:Nnnn #1#2#3#4 { - \zhnum_check_time:Nn \zhnum_int:n - { \int_div_truncate:nn \tex_time:D { 60 } } \c__zhnum_hour_tl - \zhnum_check_time:Nn \zhnum_int:n - { \int_mod:nn \tex_time:D { 60 } } \c__zhnum_minute_tl + #1 {#3} #2 \c__zhnum_hour_tl #2 + #1 {#4} #2 \c__zhnum_minute_tl } \cs_new:Npn \zhnum_digit_map:n #1 { \use:c { c__zhnum_ #1 _tl } } @@ -886,6 +925,7 @@ 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__zhnum_arabic_sep_tl } \str_new:N \l__zhnum_encoding_str \msg_new:nnnn { zhnumber } { encoding-invalid } @@ -896,7 +936,7 @@ \keys_set:nn { zhnum / options } {#1} \tex_ignorespaces:D } -\keys_set:nn { zhnum / options } { style , time } +\keys_set:nn { zhnum / options } { style , time , arabicsep = { ~ } } \ProcessKeysOptions { zhnum / options } \str_if_empty:NT \l__zhnum_encoding_str { @@ -905,13 +945,13 @@ { \keys_set:nn { zhnum / options } { encoding = GBK } } } %% -%% 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.sty'. -- cgit v1.2.3