<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
% !TEX program  = XeLaTeX
%&lt;*internal&gt;
\iffalse
%&lt;/internal&gt;
%&lt;*readme&gt;
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

    http://code.google.com/p/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, please
ensure that the "iconv" program is installed and working properly, then
running "xetex -shell-escape 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).
%&lt;/readme&gt;
%&lt;*internal&gt;
\fi
\begingroup
  \edef\tempa{\fmtname}
  \edef\tempb{plain}
\expandafter\endgroup
\ifx\tempa\tempb
\csname fi\endcsname
%&lt;/internal&gt;
%&lt;*install&gt;

\input l3docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble

   Copyright (C) 2012, 2014 by Qing Lee &lt;sobenlee@gmail.com&gt;
--------------------------------------------------------------------------
   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.

\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.
\endpostamble

\ifnum\shellescape=1 \else
  \errmessage{
    Shell escape is disabled. Please use ^^J^^J
    xetex -shell-escape \jobname.ins(dtx)^^J}
  \expandafter\endbatchfile
\fi

\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}
    \file{zhnumber-utf8.cfg}  {\from{\jobname.dtx}{config,utf8}}
    \file{zhnumber-big5.cfg}  {\from{\jobname.dtx}{config,big5}}
    \file{zhnumber-gbk.cfg}   {\from{\jobname.dtx}{config,gbk}}
    \nopreamble\nopostamble
    \usedir{doc/latex/zhnumber}
    \file{README.txt}         {\from{\jobname.dtx}{readme}}
  }

\immediate\write18{iconv -f utf-8 -t big-5 zhnumber-big5.cfg &gt; zhnumber-big5.temp}
\immediate\write18{iconv -f utf-8 -t gbk zhnumber-gbk.cfg &gt; zhnumber-gbk.temp}
\immediate\write18{mv -f zhnumber-big5.temp zhnumber-big5.cfg}
\immediate\write18{mv -f zhnumber-gbk.temp zhnumber-gbk.cfg}

\endbatchfile
%&lt;/install&gt;
%&lt;*internal&gt;
\fi
%&lt;/internal&gt;
%
%&lt;*driver|package|config&gt;
%&lt;*!config&gt;
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
%&lt;/!config&gt;
\GetIdInfo$Id: zhnumber.dtx 718 2014-09-13 09:13:29Z sobenlee $
%&lt;*driver&gt;
  {zhnumber source file}
\ProvidesExplFile{\ExplFileName.\ExplFileExtension}
%&lt;/driver&gt;
%&lt;package&gt;  {Typesetting numbers with Chinese glyphs}
%&lt;config&amp;utf8&gt;  {Chinese numerals with UTF8 encoding}
%&lt;config&amp;big5&gt;  {Chinese numerals with Big5 encoding}
%&lt;config&amp;gbk&gt;  {Chinese numerals with GBK encoding}
%&lt;package&gt;\ProvidesExplPackage
%&lt;config&gt;\ProvidesExplFile
%&lt;package&gt;  {\ExplFileName}
%&lt;config&amp;utf8&gt;  {\ExplFileName-utf8.cfg}
%&lt;config&amp;big5&gt;  {\ExplFileName-big5.cfg}
%&lt;config&amp;gbk&gt;  {\ExplFileName-gbk.cfg}
  {\ExplFileDate}{2.1}{\ExplFileDescription}
%&lt;/driver|package|config&gt;
%&lt;*driver&gt;
\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{http://code.google.com/p/ctex-kit/source/detail?r=#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\orvar{}false}
\def\TTF{\defaultvar{true}\orvar false}
\def\TFF{true\orvar\defaultvar{false}}
\def\orvar{\textup{\textbar}}
\def\defaultvar{\textbf}
\def\argbrace#1{\{#1\}}
\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}
      }
  }
\ExplSyntaxOff
\makeatother
\def\indexname{ä»£ç&nbsp;ç´¢å¼•}
\IndexPrologue{%
  \section*{\indexname}
  \markboth{\indexname}{\indexname}
  æ–œä½“çš„æ•°å­—è¡¨ç¤ºå¯¹åº”é¡¹è¯´æ˜Žæ‰€åœ¨çš„é¡µç&nbsp;ï¼Œä¸‹åˆ’çº¿çš„æ•°å­—è¡¨ç¤ºå®šä¹‰æ‰€åœ¨çš„ä»£ç&nbsp;è¡Œå·ï¼Œè€Œç›´ç«‹ä½“çš„
  æ•°å­—è¡¨ç¤ºå¯¹åº”é¡¹ä½¿ç”¨æ—¶æ‰€åœ¨çš„è¡Œå·ã€‚}
\begin{document}
  \DocInput{\jobname.dtx}
  \newgeometry{margin=15mm,footskip=7mm}
  \PrintIndex
\end{document}
%&lt;/driver&gt;
% \fi
%
% \CheckSum{1055}
% \GetFileInfo{\jobname.sty}
%
% \title{\bfseries\pkg{zhnumber} å®åŒ…}
% \author{æŽæ¸…\\ \path{sobenlee@gmail.com}}
% \date{\filedate\qquad\fileversion\thanks{\ctexkitrev{\ctexrevnum}.}}
% \maketitle
%
% \begin{documentation}
%
% \section{ç®€ä»‹}
% \pkg{zhnumber} å®åŒ…ç”¨äºŽå°†é˜¿æ‹‰ä¼¯æ•°å­—æŒ‰ç…§ä¸­æ–‡æ&nbsp;¼å¼è¾“å‡ºã€‚ç›¸æ¯”äºŽ \pkg{CJKnumb}ï¼Œå®ƒæä¾›
% çš„ä¸‰ä¸ªæ&nbsp;¼å¼è½¬æ¢å‘½ä»¤ \tn{zhnumber}ï¼Œ\tn{zhdigits} å’Œ \tn{zhnum} éƒ½æ˜¯å¯ä»¥é€‚å½“å±•å¼€çš„ï¼Œ
% å¯ä»¥æ­£å¸¸ä½¿ç”¨äºŽ |PDF| ä¹¦ç­¾å’Œäº¤å‰å¼•ç”¨ã€‚
%
% \pkg{zhnumber} æ”¯æŒ |GBK|ï¼Œ|Big5| å’Œ |UTF8| ç¼–ç&nbsp;ï¼Œä¾èµ– \hologo{LaTeX3} é¡¹ç›®çš„
% \pkg{expl3}ï¼Œ\pkg{xparse} å’Œ \pkg{l3keys2e} å®åŒ…ã€‚
%
% \section{ä½¿ç”¨æ–¹æ³•}
%
% \begin{function}[updated=2014-09-09]{encoding}
%   \begin{syntax}
%     encoding = \meta{GBK\orvar{}Big5\orvar{}UTF8}
%   \end{syntax}
%   ç”¨äºŽæŒ‡å®šç¼–ç&nbsp;çš„å®åŒ…é€‰é¡¹ï¼Œå¯ä»¥åœ¨è°ƒç”¨å®åŒ…çš„æ—¶å€™è®¾å®šï¼Œä¹Ÿå¯ä»¥ç”¨ \tn{zhnumsetup}
%   åœ¨å¯¼è¨€åŒºå†…è®¾å®šã€‚å¯¹äºŽ \upLaTeXã€\XeLaTeX{} å’Œ \LuaLaTeXï¼Œä¸ç”¨æŒ‡å®šç¼–ç&nbsp;ï¼Œå®åŒ…å°†
%   è‡ªåŠ¨ä½¿ç”¨ |UTF8| ç¼–ç&nbsp;ã€‚åªæœ‰ \LaTeX{} å’Œ \pdfLaTeX{} éœ€è¦æŒ‡å®šç¼–ç&nbsp;ï¼Œå¦‚æžœæ²¡æœ‰æŒ‡å®šï¼Œ
%   é»˜è®¤å°†ä½¿ç”¨ |GBK|ã€‚
% \end{function}
%
% \begin{function}[rEXP, updated=2014-09-12]{\zhnumber}
%   \begin{syntax}
%     \tn{zhnumber} \Arg{number}
%   \end{syntax}
%   ä»¥ä¸­æ–‡æ&nbsp;¼å¼è¾“å‡ºæ•°å­—ã€‚è¿™é‡Œçš„æ•°å­—å¯ä»¥æ˜¯æ•´æ•°ã€å°æ•°å’Œåˆ†æ•°ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhnumber{2012020120}\\
%     \zhnumber{2 012 020 120}\\
%     \zhnumber{2,012,020,120}\\
%     \zhnumber{2012.020120}\\
%     \zhnumber{2012.}\\
%     \zhnumber{.2012}\\
%     \zhnumber{20120/20120}\\
%     \zhnumber{/2012}\\
%     \zhnumber{2012/}\\
%     \zhnumber{201;2020/120}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, updated=2014-09-09]{\zhdigits}
%   \begin{syntax}
%     \tn{zhdigits}   \Arg{number}
%     \tn{zhdigits} * \Arg{number}
%   \end{syntax}
%   å°†é˜¿æ‹‰ä¼¯æ•°å­—è½¬æ¢ä¸ºä¸­æ–‡æ•°å­—ä¸²ã€‚ç¼ºçœçŠ¶æ€ä¸‹ï¼Œ\tn{zhdigits} å°† 0 æ˜&nbsp;å°„ä¸ºã€‡ï¼Œå¦‚æžœéœ€è¦
%   å°†å…¶æ˜&nbsp;å°„ä¸ºé›¶ï¼Œå¯ä»¥ä½¿ç”¨å¸¦æ˜Ÿå·çš„å½¢å¼ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhdigits{2012020120}\\
%     \zhdigits*{2012020120}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, updated=2014-09-09]{\zhnum}
%   \begin{syntax}
%     \tn{zhnum} \Arg{counter}
%   \end{syntax}
%   ä¸Ž |\roman| ç­‰ç±»ä¼¼ï¼Œç”¨äºŽå°† \LaTeX è®¡æ•°å™¨çš„å€¼è½¬æ¢ä¸ºä¸­æ–‡æ•°å­—ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhnum{section}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, added=2012-05-25]{\zhweekday}
%   \begin{syntax}
%     \tn{zhweekday} \Arg{yyyy/mm/dd}
%   \end{syntax}
%   è¾“å‡ºæ—¥æœŸå½“å¤©çš„æ˜ŸæœŸã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhweekday{2012/5/20}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, added=2012-05-25]{\zhdate}
%   \begin{syntax}
%     \tn{zhdate}   \Arg{yyyy/mm/dd}
%     \tn{zhdate} * \Arg{yyyy/mm/dd}
%   \end{syntax}
%   ä»¥ä¸­æ–‡æ&nbsp;¼å¼è¾“å‡ºæ—¥æœŸï¼Œå…¶ä¸­å¸¦ |*| çš„å‘½ä»¤è¿˜è¾“å‡ºæ˜ŸæœŸã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhdate{2012/5/21}\\
%     \zhdate*{2012/5/21}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, added=2012-05-25]{\zhtoday}
%   ä¸Ž |\today| ç±»ä¼¼ï¼Œä»¥ä¸­æ–‡è¾“å‡ºå½“å¤©çš„æ—¥æœŸã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhtoday
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, added=2012-05-25]{\zhtime}
%   \begin{syntax}
%     \tn{zhtime} \Arg{hh:mm}
%   \end{syntax}
%   ä»¥ä¸­æ–‡æ&nbsp;¼å¼è¾“å‡ºæ—¶é—´ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhtime{23:56}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[rEXP, added=2012-05-25]{\zhcurrtime}
%   è¾“å‡ºå½“å‰çš„æ—¶é—´ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhcurrtime
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[added=2012-05-25]{\zhnumExtendScaleMap}
%   \begin{syntax}
%     \tn{zhnumExtendScaleMap} \oarg{character} \argbrace{\meta{character_1}, \meta{character_2}, ..., \meta{character_n}}
%   \end{syntax}
%   ç¼ºçœçŠ¶æ€ä¸‹ \tn{zhnumber} èƒ½æ­£ç¡®ä¸­æ–‡æ&nbsp;¼å¼åŒ–çš„æœ€å¤§æ•´æ•°æ˜¯ $10^{48}-1$ï¼Œ\tn{zhdigits} ä¸å—
%   è¿™ä¸ªå¤§å°çš„é™åˆ¶ã€‚å¯ä»¥é€šè¿‡ \tn{zhnumExtendScaleMap} æ¥æ‰©å±• \tn{zhnumber}ã€‚
%   \meta{character_i} è®¾ç½® $10^{4(i+11)}$ã€‚è‹¥ç»™å‡ºå¯é€‰é¡¹ \meta{character}ï¼Œåˆ™å½“
%   æ•°å­—å¤§äºŽ $10^{4(n+12)}-1$ æ—¶ï¼Œç»Ÿä¸€ç”¨ \meta{character} è®¾ç½®è¾“å‡ºæ•°å­—çš„è¿›ä½ã€‚
% \end{function}
%
% \begin{function}{\zhnumsetup}
%   \begin{syntax}
%     \tn{zhnumsetup} \argbrace{\meta{key_1}=\meta{val_1}, \meta{key_2}=\meta{val_2}, ...}
%   \end{syntax}
%   ç”¨äºŽåœ¨å¯¼è¨€åŒºæˆ–æ–‡æ¡£ä¸­ï¼Œè®¾ç½®ä¸­æ–‡æ•°å­—çš„è¾“å‡ºæ&nbsp;¼å¼ã€‚ç›®å‰å¯ä»¥è®¾ç½®çš„ \meta{key} å¦‚ä¸‹ä»‹ç»ã€‚
% \end{function}
%
% \begin{function}[added=2012-05-25]{time}
%   \begin{syntax}
%     time =  \argbrace{\meta{Arabic}\orvar\meta{Chinese}}
%   \end{syntax}
%   è®¾ç½®æ—¥æœŸå’Œæ—¶é—´çš„æ•°å­—æ&nbsp;¼å¼ï¼Œ\meta{Arabic} ä¸ºé˜¿æ‹‰ä¼¯æ•°å­—ï¼Œè€Œ \meta{Chinese} ä¸ºä¸­æ–‡æ•°å­—ã€‚
%   é»˜è®¤ä½¿ç”¨é˜¿æ‹‰ä¼¯æ•°å­—ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.6\linewidth,gobble=5]
%     \zhnumsetup{time=Chinese}
%     \zhtoday\zhcurrtime
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}[updated=2012-05-25]{style}
%   \begin{syntax}
%     style = \argbrace{\meta{Simplified}\orvar\meta{Traditional}\orvar\meta{Normal}\orvar\meta{Financial}\orvar\meta{Ancient}}
%   \end{syntax}
%   æ„ä¹‰åˆ†åˆ«ä¸º
%
%   \begin{description}[font=\mdseries\ttfamily,align=right,labelsep=1em,labelindent=-1em,leftmargin=*]
%     \item[Simplified]  ä»¥ç®€ä½“ä¸­æ–‡è¾“å‡ºæ•°å­—ï¼ˆå¯¹ |Big5| ç¼–ç&nbsp;æ—&nbsp;æ•ˆï¼‰ï¼›
%     \item[Traditional] ä»¥ç¹ä½“ä¸­æ–‡è¾“å‡ºæ•°å­—ï¼ˆå¯¹ |Big5| ç¼–ç&nbsp;æ—&nbsp;æ•ˆï¼‰ï¼›
%     \item[Normal] ä»¥å°å†™å½¢å¼è¾“å‡ºä¸­æ–‡æ•°å­—ï¼›
%     \item[Financial]  ä»¥å¤§å†™å½¢å¼è¾“å‡ºä¸­æ–‡æ•°å­—ï¼›
%     \item[Ancient] ä»¥å»¿è¾“å‡º 20ï¼Œä»¥å…è¾“å‡º 30ï¼Œä»¥åŒè¾“å‡º 40ï¼Œä»¥çš•è¾“å‡º 200ã€‚
%   \end{description}
%
%   å¯ä»¥è®¾ç½® |style| ä¸ºå…¶ä¸­ä¸€ä¸ªï¼Œä¹Ÿå¯ä»¥æ˜¯å‰ä¸‰ä¸ªä¸ŽåŽä¸¤ä¸ªçš„é€‚å½“ç»„åˆï¼Œé»˜è®¤æ˜¯ç®€ä½“å°å†™ã€‚ä¾‹å¦‚
%   \begin{SideBySideExample}[frame=single,numbers=left,xrightmargin=.4\linewidth,gobble=5]
%     \zhnumsetup{style={Traditional,Financial}}
%     \zhnumber{62012.3}\\
%     \zhnumsetup{style=Ancient}
%     \zhnumber{21}
%   \end{SideBySideExample}
% \end{function}
%
% \begin{function}{null}
%   \begin{syntax}
%     null = \meta{\TFF}
%   \end{syntax}
%   ç¼ºçœçŠ¶æ€ä¸‹ï¼Œé™¤äº† \tn{zhdigits} å¤–ï¼Œå…¶å®ƒçš„æ&nbsp;¼å¼è½¬æ¢å‘½ä»¤ï¼Œå°† 0 æ˜&nbsp;å°„æˆé›¶ï¼Œå¦‚æžœéœ€è¦å°† 0 æ˜&nbsp;å°„
%   æˆã€‡ï¼Œå¯ä»¥ä½¿ç”¨è¿™ä¸ªé€‰é¡¹ã€‚\strut
% \end{function}
%
% \pkg{zhnumber} æä¾›ä¸‹åˆ—é€‰é¡¹æ¥æŽ§åˆ¶é˜¿æ‹‰ä¼¯æ•°å­—çš„ä¸­æ–‡æ˜&nbsp;å°„ã€‚
% \begin{verbatim}[frame=single]
%   - -0 0 1 2 3 4 5 6 7 8 9 10 20 30 40 100 200 1000
%   E2 E3 E4 E8 E12 E16 E20 E24 E28 E32 E36 E40 E44
%   F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F100 F1000 FE2 FE3
%   dot and parts
%   year month day hour minute weekday mon tue wed thu fri sat sun
% \end{verbatim}
% å…¶ä¸­ |-| è®¾ç½®è´Ÿï¼Œ|-0| è®¾ç½®ã€‡ï¼Œ|dot| è®¾ç½®å°æ•°çš„ç‚¹ï¼Œ|and| å’Œ |parts| åˆ†åˆ«è®¾ç½®åˆ†æ•°
% çš„â€œåˆâ€å’Œâ€œåˆ†ä¹‹â€ï¼Œ|E|$n$ è®¾ç½® $10^n$ï¼Œè€Œ |F|$n$ è®¾ç½®æ•°å­— $n$ çš„å¤§å†™ã€‚å…¶å®ƒçš„é€‰é¡¹åŒ
% å­—é¢æ„æ€ï¼Œä¸å†èµ˜è¿°ã€‚ä¾‹å¦‚
% \begin{verbatim}[frame=single]
%   \zhnumsetup{2={ä¸¤}}
% \end{verbatim}
% å¯ä»¥å°† 2 æ˜&nbsp;å°„æˆä¸¤ã€‚éœ€è¦è¯´æ˜Žçš„æ˜¯ï¼Œ\pkg{zhnumber} å°†ä¼˜å…ˆä½¿ç”¨è¿™é‡Œçš„è®¾ç½®ï¼Œæ‰€ä»¥å¯èƒ½ä¼šå½±å“
% åˆ° |style| é€‰é¡¹ã€‚å¦‚æžœè¦æ¢å¤ |style| çš„åŠŸèƒ½ï¼Œå¯ä»¥ä½¿ç”¨ |reset| é€‰é¡¹ã€‚
%
% \begin{function}[updated=2014-09-12]{reset}
%   \begin{syntax}
%     reset
%   \end{syntax}
%   ç”¨äºŽæ¢å¤ \pkg{zhnumber} å¯¹é˜¿æ‹‰ä¼¯æ•°å­—çš„åˆå§‹åŒ–æ˜&nbsp;å°„ã€‚\pkg{zhnumber} çš„ä¸­æ–‡æ•°å­—åˆå§‹åŒ–
%   è®¾ç½®è§æºä»£ç&nbsp;ï¼ˆç¬¬ \ref{sec:zhnum-map} èŠ‚ï¼‰ã€‚
% \end{function}
%
% \begin{function}[added=2014-09-09]{activechar}
%   \begin{syntax}
%     activechar = \meta{\TTF}
%   \end{syntax}
%   åœ¨ \LaTeX{} æˆ–è€… \pdfLaTeX{} ä¸‹é¢è¾“å‡ºæ±‰å­—ï¼Œä¼&nbsp;ç»Ÿçš„åŠžæ³•éœ€è¦å°†æ±‰å­—çš„é¦–å­—èŠ‚è®¾ç½®ä¸º
%   æ´»åŠ¨å­—ç¬¦ï¼Œç„¶åŽå†é€šè¿‡ç‰¹æ®Šçš„å®æŠ€å·§æ¥å®žçŽ°ã€‚å›&nbsp;æ­¤ï¼Œ\pkg{zhnumber} åœ¨è½½å…¥é…ç½®æ–‡ä»¶çš„
%   æ—¶å€™ï¼Œé»˜è®¤ä¼šå°†æ±‰å­—çš„é¦–å­—èŠ‚è®¾ç½®ä¸ºæ´»åŠ¨å­—ç¬¦ã€‚ç¦ç”¨æœ¬é€‰é¡¹å°†ä¸ä¼šæ”¹å˜æ±‰å­—é¦–å­—èŠ‚çš„
%   ç±»ä»£ç&nbsp;ã€‚éœ€è¦åœ¨æœ¬é€‰é¡¹ä¹‹åŽï¼Œä½¿ç”¨ \texttt{encoding} æˆ–è€… \texttt{reset} é€‰é¡¹
%   æ‰ä¼šæœ‰æ•ˆæžœã€‚
% \end{function}
%
% \begin{function}[updated=2014-09-09]{\zhnumber,\zhdigits,\zhnum}
%   \begin{syntax}
%     \tn{zhnumber}   \oarg{options} \Arg{number}
%     \tn{zhdigits} * \oarg{options} \Arg{number}
%     \tn{zhnum}      \oarg{options} \Arg{counter}
%   \end{syntax}
%   å¦‚æžœåªæ”¹å˜å½“å‰æ•°å­—çš„ä¸­æ–‡è¾“å‡ºæ&nbsp;¼å¼ï¼Œå¯ä»¥ä½¿ç”¨å¸¦é€‰é¡¹çš„æ&nbsp;¼å¼è½¬æ¢å‘½ä»¤ï¼Œå…¶ä¸­ \meta{options}
%   ä¸Ž \tn{zhnumsetup} çš„å‚æ•°ç›¸åŒï¼Œå¦‚ä¸Šæ‰€ä»‹ç»ã€‚è¿™äº›å¸¦äº†é€‰é¡¹çš„å‘½ä»¤æ˜¯ä¸å¯å±•å¼€çš„ï¼Œåœ¨æŸäº›åœºåˆä½¿
%   ç”¨æ—¶è¦å°å¿ƒã€‚
% \end{function}
%
% \end{documentation}
%
% \StopEventually{}
%
% \begin{implementation}
%
% \section{\pkg{zhnumber} å®åŒ…ä»£ç&nbsp;å®žçŽ°}
%
%    \begin{macrocode}
%&lt;*package&gt;
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;@@=zhnum&gt;
%    \end{macrocode}
%
%    \begin{macrocode}
\msg_new:nnn { zhnumber } { l3-too-old }
  {
    Support~package~'expl3'~too~old. \\\\
    Please~update~an~up~to~date~version~of~the~bundles\\\\
    'l3kernel'~and~'l3packages'\\\\
    using~your~TeX~package~manager~or~from~CTAN.
  }
\@ifpackagelater { expl3 } { 2014/08/25 } { }
  { \msg_error:nn  { zhnumber }  { l3-too-old } }
%    \end{macrocode}
%
%    \begin{macrocode}
\RequirePackage { xparse , l3keys2e }
%    \end{macrocode}
%
% \begin{macro}{\zhnumber}
% ç”¨äºŽå°†è¾“å…¥çš„æ•°å­—æŒ‰ç…§ä¸­æ–‡æ&nbsp;¼å¼è¾“å‡ºã€‚
%    \begin{macrocode}
\DeclareExpandableDocumentCommand \zhnumber { +o +m }
  {
    \IfNoValueTF {#1}
      { \zhnum_number:f }
      { \zhnumberwithoptions {#1} }
    {#2}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhnumberwithoptions}
% å¸¦é€‰é¡¹çš„ç”¨æˆ·å‡½æ•°ã€‚
%    \begin{macrocode}
 \NewDocumentCommand \zhnumberwithoptions { +m +m }
  {
    \group_begin:
      \keys_set:nn { zhnum / options } {#1}
      \zhnum_number:f {#2}
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_number:n}
% \begin{macro}[aux]{\@@_number:www}
% å…ˆåˆ¤æ–­è¾“å…¥çš„æ˜¯å°æ•°è¿˜æ˜¯åˆ†æ•°ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_number:n #1
  { \@@_number:www #1 . \q_nil . \q_stop }
\cs_new:Npn \@@_number:www #1 . #2 . #3 \q_stop
  {
    \quark_if_nil:nTF {#2}
      { \@@_integer_or_fraction:www #1 / \q_nil / \q_stop }
      { \zhnum_decimal:nn {#1} {#2} }
  }
\cs_generate_variant:Nn \zhnum_number:n { f }
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}[aux]{\@@_integer_or_fraction:www}
% åˆ¤æ–­æ˜¯å¦è¾“å…¥çš„æ˜¯åˆ†æ•°ã€‚
%    \begin{macrocode}
\cs_new:Npn \@@_integer_or_fraction:www #1 / #2 / #3 \q_stop
  {
    \quark_if_nil:nTF {#2}
      { \zhnum_integer:n {#1} }
      { \@@_fraction:wwww #2 \q_mark #1 ; \q_nil ; \q_stop }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]{\@@_fraction:wwww}
% å¯¹åˆ†æ•°è¿›è¡Œé¢„å¤„ç†ã€‚
%    \begin{macrocode}
\cs_new:Npn \@@_fraction:wwww #1 \q_mark #2 ; #3 ; #4 \q_stop
  {
    \quark_if_nil:nTF {#3}
      {
        \zhnum_blank_to_zero:n {#1}
        \c_@@_parts_tl
        \zhnum_blank_to_zero:n {#2}
      }
      {
        \tl_if_blank:nF {#2}
          {
            \zhnum_number:n {#2}
            \c_@@_and_tl
          }
        \zhnum_blank_to_zero:n {#1}
        \c_@@_parts_tl
        \zhnum_blank_to_zero:n {#3}
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_decimal:nn}
% å¯¹å°æ•°è¿›è¡Œé¢„å¤„ç†ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_decimal:nn #1#2
  {
    \zhnum_blank_to_zero:n {#1} \c_@@_dot_tl
    \tl_if_blank:nTF {#2}
      { \c_@@_zero_tl }
      { \zhnum_digits_zero:n {#2} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_blank_to_zero:n}
% è¾“å‡ºå°æ•°çš„æ•´æ•°ä½ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_blank_to_zero:n #1
  {
    \tl_if_blank:nTF {#1}
      { \c_@@_zero_tl }
      { \zhnum_number:n {#1} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhnum,\zhnumberwithoptions}
% ç”¨äºŽå°† \LaTeX{} è®¡æ•°å™¨æŒ‰ä¸­æ–‡æ&nbsp;¼å¼è¾“å‡ºã€‚
%    \begin{macrocode}
\DeclareExpandableDocumentCommand \zhnum { +o +m }
  {
    \IfNoValueTF {#1}
      { \zhnum_counter:n }
      { \zhnumwithoptions {#1} }
    {#2}
  }
\NewDocumentCommand \zhnumwithoptions { +m +m }
  {
    \group_begin:
      \keys_set:nn { zhnum / options } {#1}
      \zhnum_counter:n {#2}
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_counter:n, \zhnum_int:n}
% å¯ä»¥ç›´æŽ¥é€šè¿‡æ¯”è¾ƒ \LaTeX{} è®¡æ•°å™¨çš„å€¼æ¥å¾—åˆ°ç¬¦å·å’Œç»å¯¹å€¼ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_counter:n #1
  {
    \int_if_exist:cTF { c@#1 }
      { \zhnum_int:c { c@#1 } }
      { \@@_counter_error:n {#1} }
  }
\cs_new:Npn \@@_counter_error:n #1
  { \__msg_expandable_error:n { `#1'~is~not~a~LaTeX~counter. } }
\cs_new:Npn \zhnum_int:n #1
  {
    \int_compare:nNnTF {#1} &gt; \c_zero
      { \zhnum_parse_number:f { \int_eval:n {#1} } }
      {
        \int_compare:nNnTF {#1} &lt; \c_zero
          {
            \c_@@_minus_tl
            \zhnum_parse_number:f { \int_eval:n { - #1 } }
          }
          { \c_@@_zero_tl }
      }
  }
\cs_generate_variant:Nn \zhnum_int:n { c }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_integer:n}
% å¯¹æ•´æ•°çš„å¤„ç†ã€‚è¿™ä¸ªå‡½æ•°åŸºæœ¬æŠ„å½•è‡ª \pkg{l3bigint} çš„ \cs{__bingint_read_do:nn}ã€‚å®ƒå¯ä»¥
% æ­£ç¡®å–å¾—ç¬¦å·ï¼ŒåŽ»æŽ‰å¤šä½™çš„é›¶ï¼Œè¿˜å¯ä»¥å¾ªçŽ¯å±•å¼€æ•°å­—ã€‚ä½†å®ƒåœ¨é‡åˆ°éžæ•°å­—çš„æ—¶å€™å°±åœæ­¢äº†
% å¾ªçŽ¯ï¼Œæˆ‘ä»¬å¯èƒ½éœ€è¦éžæ•°å­—ï¼ˆä¾‹å¦‚é€—å·ï¼‰æ¥ä½œä¸ºåˆ†éš”ç¬¦å·ã€‚å›&nbsp;æ­¤å¯¹å®ƒç•¥ä½œä¿®æ”¹ï¼Œè·³è¿‡éžæ•°å­—ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_integer:n #1
  {
    \exp_after:wN \@@_read_integer:www
    \tex_number:D
      \exp_after:wN \@@_read_sign_loop:N
      \tex_romannumeral:D -`0 \use:n
      #1 \exp_stop_f: \q_recursion_tail \q_recursion_stop
         \@@_result:nn { \c_zero } { } ;
  }
\cs_new:Npn \@@_read_sign_loop:N #1
  {
    \if:w + \if:w - \exp_not:N #1 + \fi: \exp_not:N #1
      \exp_after:wN \@@_read_sign_loop:N
      \tex_romannumeral:D -`0 \exp_after:wN \use:n
    \else:
      1 \exp_after:wN ;
      \tex_romannumeral:D -`0
        \exp_after:wN \@@_read_zeros_loop:N
        \exp_after:wN #1
    \fi:
  }
\cs_new:Npn \@@_read_zeros_loop:N #1
  {
    \if:w 0 \exp_not:N #1
      \exp_after:wN \@@_read_zeros_loop:N
      \tex_romannumeral:D -`0 \exp_after:wN \use:n
    \else:
      \exp_after:wN \@@_read_abs_loop:Nw
      \exp_after:wN #1
    \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]{\@@_read_abs_loop:Nw}
% å½“æ•°å­—å¾ˆå¤§æ—¶ï¼Œ\pkg{l3bigint} çš„å®žçŽ°ä¼šé€&nbsp;æˆ \TeX{} å†…å­˜æº¢å‡ºï¼š
% \begin{verbatim}
%   ! TeX capacity exceeded, sorry [expansion depth=10000].
% \end{verbatim}
% æˆ‘ä»¬åœ¨è¿™é‡Œå‚è€ƒ \cs{__tl_act:NNNnn} çš„å®žçŽ°å¯¹å®ƒè¿›è¡Œäº†æ”¹è¿›ã€‚
%    \begin{macrocode}
\cs_new:Npn \@@_read_abs_loop:Nw #1#2 \q_recursion_stop
  {
    \zhnum_if_digit:NTF #1
      { \@@_output:nnwnn { + \c_one } #1 }
      { \quark_if_recursion_tail_stop_do:Nn #1 { \@@_loop_end:wnn } }
    \exp_after:wN \@@_read_abs_loop:Nw
      \tex_romannumeral:D -`0 \use:n #2 \q_recursion_stop
  }
\cs_new:Npn \@@_output:nnwnn #1#2#3 \@@_result:nn #4#5
  { #3 \@@_result:nn { #4#1 } { #5#2 } }
\cs_new:Npn \@@_loop_end:wnn #1 \@@_result:nn #2#3
  { \int_eval:n {#2} ; #3 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]{\@@_read_integer:www}
% |#1| ç¬¦å·ï¼Œ|#3| æ˜¯ç»å¯¹å€¼ï¼Œ|#2| æ˜¯ç»å¯¹å€¼çš„é•¿åº¦ã€‚
%    \begin{macrocode}
\cs_new:Npn \@@_read_integer:www #1 ; #2 ; #3 ;
  {
    \int_compare:nNnTF {#2} = \c_zero
      { \c_@@_zero_tl }
      {
        \int_compare:nNnF {#1} = \c_one
          { \c_@@_minus_tl }
        \zhnum_parse_number:nn {#2} {#3}
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_if_digit:NTF}
% åˆ¤æ–­ |#1| æ˜¯å¦ä¸ºæ•°å­—ä½ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_if_digit:NTF #1
  {
    \if_int_compare:w \c_nine &lt; 1 \exp_not:N #1 \exp_stop_f:
      \exp_after:wN \use_i:nn
    \else:
      \exp_after:wN \use_ii:nn
    \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%   {
%     \zhnum_parse_number:n,
%     \zhnum_parse_number:nn
%   }
%    \begin{macrocode}
\cs_new:Npn \zhnum_parse_number:n #1
  { \exp_args:Nf \zhnum_parse_number:nn { \tl_count:n {#1} } {#1} }
\cs_new:Npn \zhnum_parse_number:nn #1
  { \exp_args:Nf \@@_parse_number:nnn { \int_mod:nn {#1} \c_four } {#1} }
\cs_new:Npn \@@_parse_number:nnn #1#2
  {
    \int_compare:nNnTF {#2} &lt; \c_two
      { \zhnum_digit_map:n }
      {
        \int_compare:nNnTF {#1} = \c_zero
          { \zhnum_split_number:fn { \int_eval:n { #2 / \c_four - \c_one } } }
          { \@@_split_number_aux:nnn {#1} {#2} }
      }
  }
\cs_generate_variant:Nn \zhnum_parse_number:n { f }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[aux]{\@@_split_number_aux:nnn}
% ä¸ºäº†å¤„ç†çš„æ–¹ä¾¿ï¼Œåœ¨æ•´æ•°å‰é¢è¡¥ä¸Šé€‚å½“çš„ $0$ï¼Œä½¿å…¶ä½æ•°å¯ä»¥è¢« $4$ æ•´é™¤ã€‚
%    \begin{macrocode}
\cs_new:Npn \@@_split_number_aux:nnn #1#2
  {
    \exp_after:wN \@@_split_number_aux:wwn
      \tex_number:D \int_div_truncate:nn {#2} \c_four
        \if_case:w #1 \exp_stop_f:
          \or: \exp_after:wN \use:n
          \or: \exp_after:wN \use_i_ii:nnn
          \or: \exp_after:wN \use_i:nnn
        \fi:
        { \exp_stop_f: ; 0 } 0 0 ;
  }
\cs_new:Npn \@@_split_number_aux:wwn #1 ; #2 ; #3
  { \zhnum_split_number:nn {#1} { #2#3 } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_split_number:nn}
% æœ€åŽåŠ&nbsp;å…¥çš„ \cs{q_recursion_tail} æ˜¯åœæ­¢é€’å½’çš„æ&nbsp;‡å¿—ï¼Œè€Œ \cs{q_nil} ç”¨äºŽå&nbsp;ä½ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_split_number:nn #1#2
  {
    \zhnum_split_number:NNnNNNNw \c_true_bool \c_true_bool {#1}
      #2 \q_recursion_tail \q_nil \q_nil \q_nil \q_recursion_stop
  }
\cs_generate_variant:Nn \zhnum_split_number:nn { f }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_split_number:NNnNNNNw}
% å°†è¾“å…¥çš„æ•´æ•°ç”±é«˜ä½åˆ°ä½Žä½ï¼Œä»¥å››ä½ä¸ºä¸€æ®µè¿›è¡Œå¤„ç†ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_split_number:NNnNNNNw #1#2#3#4#5#6#7#8 \q_recursion_stop
  {
    \quark_if_recursion_tail_stop:N #4
    \int_compare:nNnTF { #4#5#6#7 } = \c_zero
      { \use_i:nn }
      {
        \bool_if:NF #1 { \c_@@_zero_tl }
        \zhnum_process_number:NNNNNN #4#5#6#7#1#2
        \zhnum_scale_map:n {#3}
        \int_compare:nNnTF {#7} = \c_zero
      }
      { \zhnum_split_number:NNfNNNNw \c_false_bool \c_true_bool }
      { \zhnum_split_number:NNfNNNNw \c_true_bool  \c_false_bool }
    { \int_eval:n { #3 - \c_one } } #8 \q_recursion_stop
  }
\cs_generate_variant:Nn \zhnum_split_number:NNnNNNNw { NNf }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_process_number:NNNNNN}
% å¯¹å››ä½æ•°å­—æŒ‰æƒ…å†µè¿›è¡Œå¤„ç†ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_process_number:NNNNNN #1#2#3#4#5#6
  {
    \int_compare:nNnTF {#1} = \c_zero
      { \bool_if:NF #6 { \c_@@_zero_tl } }
      { \zhnum_digit_map:n {#1} \c_@@_thousand_tl }
    \int_compare:nNnTF {#2} = \c_zero
      { \int_compare:nNnF { #1 * (#3#4) } = \c_zero { \c_@@_zero_tl } }
      {
        \bool_if:nTF
          { \l_@@_ancient_bool &amp;&amp; \int_compare_p:nNn {#2} = \c_two }
          { \zhnum_digit_map:n { #2 00 } }
          { \zhnum_digit_map:n {#2} \c_@@_hundred_tl }
      }
    \int_compare:nNnTF {#3} = \c_zero
      { \int_compare:nNnF { #2 * #4 } = \c_zero { \c_@@_zero_tl } }
      {
        \bool_if:nF
          {
            \int_compare_p:nNn {#3}   = \c_one  &amp;&amp;
            \int_compare_p:nNn {#1#2} = \c_zero &amp;&amp; #6 &amp;&amp; #5
          }
          {
            \bool_if:nTF
              {
                \l_@@_ancient_bool                   &amp;&amp;
                ( \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 { #3 0 } \use_none:n }
              { \zhnum_digit_map:n {#3} }
          }
        \c_@@_ten_tl
      }
    \int_compare:nNnF {#4} = \c_zero { \zhnum_digit_map:n {#4} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhdigits,\zhdigitswithoptions}
% å°†è¾“å…¥çš„æ•°å­—è¾“å‡ºä¸ºä¸­æ–‡æ•°å­—ä¸²è¾“å‡ºã€‚
%    \begin{macrocode}
\DeclareExpandableDocumentCommand \zhdigits { +s +o +m }
  {
    \IfNoValueTF {#2}
      { \zhnum_digits:Nn #1 }
      { \zhdigitswithoptions {#1} {#2} }
    {#3}
  }
\NewDocumentCommand \zhdigitswithoptions { +m +m +m }
  {
    \group_begin:
      \keys_set:nn { zhnum / options } {#2}
      \zhnum_digits:Nn #1 {#3}
    \group_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_digits_zero:n,\zhnum_digits_null:n}
% å¿«æ·æ–¹å¼ã€‚
%    \begin{macrocode}
\cs_new_nopar:Npn \zhnum_digits_zero:n
  { \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 }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_digits:Nn}
% ä¸Ž \cs{zhnum_integer:n} ç±»ä¼¼ï¼Œä½†ä¸ç”¨åŽ»æŽ‰å¤šä½™çš„é›¶ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_digits:Nn #1#2
  {
    \exp_after:wN \@@_read_digits:w
    \tex_number:D
      \exp_after:wN \@@_read_sign_loop:NN \exp_after:wN #1
      \tex_romannumeral:D -`0 \use:n
      #2 \exp_stop_f: \q_recursion_tail \q_recursion_stop
  }
\cs_new:Npn \@@_read_sign_loop:NN #1#2
  {
    \if:w + \if:w - \exp_not:N #2 + \fi: \exp_not:N #2
      \exp_after:wN \@@_read_sign_loop:NN \exp_after:wN #1
      \tex_romannumeral:D -`0 \exp_after:wN \use:n
    \else:
      1 \exp_after:wN ;
        \exp_after:wN \@@_read_digits_loop:NN
        \exp_after:wN #1
        \exp_after:wN #2
    \fi:
  }
\cs_new:Npn \@@_read_digits_loop:NN #1#2
  {
    \zhnum_if_digit:NTF #2
      { \@@_output_digits:NN #1#2 }
      {
        \quark_if_recursion_tail_stop:N #2
        \if:w .\exp_not:N #2 \exp_after:wN \c_@@_dot_tl \fi:
      }
    \exp_after:wN \@@_read_digits_loop:NN \exp_after:wN #1
        \tex_romannumeral:D -`0 \use:n
  }
\cs_new:Npn \@@_read_digits:w #1 ;
  {
    \int_compare:nNnF {#1} = \c_one
      { \c_@@_minus_tl }
  }
\cs_new:Npn \@@_output_digits:NN #1#2
  {
    \cs:w
      c_@@_
        \if_int_compare:w #2 = \c_zero
          \IfBooleanTF #1 { zero } { null }
        \else:
          #2
        \fi:
      _tl
    \cs_end:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhdate}
% è¾“å‡ºä¸­æ–‡æ—¥æœŸã€‚
%    \begin{macrocode}
\DeclareExpandableDocumentCommand \zhdate { +s +m }
  {
    \@@_date:www #2 \q_stop
    \IfBooleanT #1
      { \@@_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
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhtoday}
% è¾“å‡ºå½“å¤©æ—¥æœŸã€‚
%    \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
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_check_time:Nn}
% åˆ¤æ–­æ˜¯ç”¨ä¸­æ–‡æ•°å­—è¿˜æ˜¯ç”¨é˜¿æ‹‰ä¼¯æ•°ç»„ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_check_time:Nn #1
  { \bool_if:NTF \l_@@_time_bool {#1} { \int_to_arabic:n } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhweekday}
% è¾“å‡ºæ˜ŸæœŸ
%    \begin{macrocode}
\cs_new:Npn \zhweekday #1
  { \@@_week_day:www #1 \q_stop }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\@@_week_day:www}
% ç”¨ Zeller å…¬å¼è®¡ç®—çš„ç»“æžœ $h$ ä¸Žå®žé™…æ˜ŸæœŸçš„å…³ç³»æ˜¯ $d=h+5\pmod7+1$ã€‚
%    \begin{macrocode}
\cs_new:Npn \@@_week_day:www #1/#2/#3 \q_stop
  {
    \if_case:w \zhnum_Zeller:nnn {#1} {#2} {#3} \exp_stop_f:
           \c_@@_sat_tl
      \or: \c_@@_sun_tl
      \or: \c_@@_mon_tl
      \or: \c_@@_tue_tl
      \or: \c_@@_wed_tl
      \or: \c_@@_thu_tl
      \or: \c_@@_fri_tl
    \fi:
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_Zeller:nnn,\zhnum_Zeller_aux:Nnnn,\zhnum_two_digits:n}
% ç”¨ Zeller å…¬å¼\footnote{\url{http://en.wikipedia.org/wiki/Zeller's_congruence}}
% è®¡ç®—æ˜ŸæœŸå‡&nbsp;ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_Zeller:nnn #1#2#3
  {
    \int_compare:nNnTF
      { #1 \zhnum_two_digits:n {#2} \zhnum_two_digits:n {#3} } &gt; { 1582 10 04 }
      { \@@_Zeller_aux:Nnnn \zhnum_Zeller_Gregorian:nnn }
      { \@@_Zeller_aux:Nnnn \zhnum_Zeller_Julian:nnn }
    {#1} {#2} {#3}
  }
\cs_new:Npn \@@_Zeller_aux:Nnnn  #1#2#3#4
  {
    \int_compare:nNnTF {#3} &lt; \c_three
      { #1 { #2 - \c_one } { #3 + \c_twelve } {#4} }
      { #1 {#2} {#3} {#4} }
  }
\cs_new:Npn \zhnum_two_digits:n #1
  {
    \int_compare:nNnT {#1} &lt; \c_ten { 0 }
    \int_eval:n {#1}
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_Zeller_Gregorian:nnn}
% æ&nbsp;¼é‡ŒåŽ†ï¼ˆ\zhdate{1582/10/15}åŠä»¥åŽï¼‰çš„è®¡ç®—å…¬å¼
% \[
%   h = \biggl(q + \biggl\lfloor\frac{26(m+1)}{10}\biggr\rfloor + Y +
%   \biggl\lfloor\frac Y4\biggr\rfloor + 6\biggl\lfloor\frac Y{100}\biggr\rfloor
%   + \biggl\lfloor\frac Y{400}\biggr\rfloor\biggr) \pmod 7
% \]
% å…¶ä¸­ $Y$ ä¸ºå¹´ï¼Œ$m$ ä¸ºæœˆï¼Œ$q$ ä¸ºæ—¥ï¼›è‹¥ $m=1,2$ï¼Œåˆ™ä»¤ $m\mathbin{{+}{=}}12$ï¼ŒåŒæ—¶ $Y\mathop{--}{}$ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_Zeller_Gregorian:nnn #1#2#3
  {
    \int_mod:nn
      {
          (#3)
        + \int_div_truncate:nn { 26 * ( #2 + \c_one ) } \c_ten
        + (#1)
        + \int_div_truncate:nn {#1} \c_four
        + \c_six * \int_div_truncate:nn {#1} \c_one_hundred
        + \int_div_truncate:nn {#1} { 400 }
      }
      { \c_seven }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_Zeller_Julian:nnn}
% å„’ç•¥åŽ†ï¼ˆ\zhdate{1582/10/04}åŠä»¥å‰ï¼‰çš„è®¡ç®—å…¬å¼
% \[
%   h = \biggl(q + \biggl\lfloor\frac{26(m+1)}{10}\biggr\rfloor + Y +
%   \biggl\lfloor\frac Y4\biggr\rfloor + 5\biggr) \pmod 7
% \]
%    \begin{macrocode}
\cs_new:Npn \zhnum_Zeller_Julian:nnn #1#2#3
  {
    \int_mod:nn
      {
          (#3)
        + \int_div_truncate:nn { 26 * ( #2 + \c_one ) } \c_ten
        + (#1)
        + \int_div_truncate:nn {#1} \c_four
        + \c_five
      }
      { \c_seven }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhtime}
% è¾“å‡ºæ—¶é—´ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhtime #1
  { \@@_time:ww #1 \q_stop }
\group_begin:
\char_set_lccode:nn { `\; } { `\: }
\tl_to_lowercase:n
  {
    \group_end:
    \cs_new:Npn \@@_time:ww #1 ; #2 \q_stop
      {
        \zhnum_check_time:Nn \zhnum_int:n {#1} \c_@@_hour_tl
        \zhnum_check_time:Nn \zhnum_int:n {#2} \c_@@_minute_tl
      }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhcurrtime}
% è¾“å‡ºå½“å‰æ—¶é—´ã€‚
%    \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
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_digit_map:n}
% é˜¿æ‹‰ä¼¯æ•°å­—ä¸Žä¸­æ–‡æ•°å­—çš„æ˜&nbsp;å°„ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_digit_map:n #1
  { \use:c { c_@@_ #1 _tl } }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_scale_map:n,\zhnum_scale_map_loop:n}
% å¤§æ•°ç³»ç»Ÿçš„æ˜&nbsp;å°„ã€‚
%    \begin{macrocode}
\cs_new:Npn \zhnum_scale_map:n #1
  {
    \cs_if_exist_use:cF { c_@@_s #1 _tl }
      { \zhnum_scale_map_hook:n {#1} }
  }
\cs_new:Npn \zhnum_scale_map_loop:n #1
  { \zhnum_scale_map:n { \int_mod:nn {#1} \l_@@_scale_int } }
\cs_generate_variant:Nn \zhnum_scale_map:n { f }
\int_new:N \l_@@_scale_int
\int_set_eq:NN \l_@@_scale_int \c_eleven
\cs_new_eq:NN \zhnum_scale_map_hook:n \zhnum_scale_map_loop:n
\tl_const:cn { c_@@_s0_tl } { }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhnumExtendScaleMap}
% æ‰©å±•è¿›ä½ç³»ç»Ÿã€‚
%    \begin{macrocode}
\NewDocumentCommand \zhnumExtendScaleMap { &gt; { \TrimSpaces } +o +m }
  {
    \int_zero:N \l_tmpa_int
    \clist_map_function:nN {#2} \zhnum_set_scale:n
    \IfNoValueF {#1}
      { \cs_set:Npn \zhnum_scale_map_hook:n ##1 {#1} }
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_set_scale:n}
%    \begin{macrocode}
\cs_new_protected:Npn \zhnum_set_scale:n #1
  {
    \int_incr:N \l_tmpa_int
    \tl_set:Nx \l_tmpa_tl
      { c_@@_s \int_eval:n { \l_tmpa_int + \c_eleven } _tl }
    \tl_if_exist:cF { \l_tmpa_tl }
      { \int_incr:N \l_@@_scale_int }
    \tl_set:cn { \l_tmpa_tl } {#1}
  }
%    \end{macrocode}
% \end{macro}

% æ&nbsp;¹æ®éœ€è¦è®¾ç½®ä¸­æ–‡é˜¿æ‹‰ä¼¯æ•°å­—ã€‚
%    \begin{macrocode}
\group_begin:
  \tl_set:Nn \l_tmpa_tl
    {
      -   .tl_set:N = \l_@@_minus_tl ,
      -0  .tl_set:N = \l_@@_null_tl ,
    }
  \tl_put_right:Nx \l_tmpa_tl
    {
      E2  .tl_set:N = \exp_not:c { l_@@_ 100 _tl } ,
      E3  .tl_set:N = \exp_not:c { l_@@_ 1000 _tl } ,
      FE2 .tl_set:N = \exp_not:c { l_@@_financial_ 100 _tl } ,
      FE3 .tl_set:N = \exp_not:c { l_@@_financial_ 1000 _tl } ,
    }
  \clist_map_inline:nn
    { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 100 , 1000 }
    {
      \tl_put_right:Nx \l_tmpa_tl
        {
           #1 .tl_set:N = \exp_not:c { l_@@_ #1 _tl } ,
          F#1 .tl_set:N = \exp_not:c { l_@@_financial_ #1 _tl } ,
        }
    }
  \clist_map_inline:nn
    { 20 , 30 , 40 , 200 }
    {
      \tl_put_right:Nx \l_tmpa_tl
        { #1 .tl_set:N = \exp_not:c { l_@@_ #1 _tl } , }
    }
  \clist_map_inline:nn
    { 4 , 8 , 12 , 16 , 20 , 24 , 28 , 32 , 36 , 40 , 44 }
    {
      \tl_put_right:Nx \l_tmpa_tl
        { E#1 .tl_set:N = \exp_not:c { l_@@_ s \int_eval:n { #1 / 4 } _tl } , }
    }
  \clist_map_inline:nn
    {
      dot , and , parts , year , month , day , weekday , hour , minute
      mon , tue , wed , thu , fri , sat , sun
    }
    {
      \tl_put_right:Nx \l_tmpa_tl
        { #1 .tl_set:N = \exp_not:c { l_@@_ #1 _tl } , }
    }
\use:x
  {
    \group_end:
    \keys_define:nn { zhnum / options } { \exp_not:o \l_tmpa_tl }
  }
%    \end{macrocode}
%
% \begin{macro}[internal]
%   {
%     \zhnum_set_digits_map:nn,
%     \zhnum_set_digits_map:nnn,
%     \zhnum_set_financial_map:nn,
%     \zhnum_set_financial_map:nnn,
%     \l_@@_cfg_map_prop,
%     \l_@@_cfg_map_var_prop,
%     \l_@@_cfg_map_finan_prop
%   }
% å°†é…ç½®æ–‡ä»¶ä¸­çš„ä¸­æ–‡æ•°å­—ä¿å­˜åˆ° \texttt{prop} å˜é‡ä¸­ã€‚
%    \begin{macrocode}
\cs_new_protected:Npn \zhnum_set_digits_map:nn #1#2
  { \prop_put:Nnn \l_@@_cfg_map_prop {#1} {#2} }
\cs_new_protected:Npn \zhnum_set_digits_map:nnn #1#2#3
  {
    \prop_put_if_new:Nnn \l_@@_cfg_map_prop {#1} {#3}
    \prop_put:Nnn \l_@@_cfg_map_var_prop {#1_#2} {#3}
  }
\cs_new_protected:Npn \zhnum_set_financial_map:nn #1#2
  { \prop_put:Nnn \l_@@_cfg_map_finan_prop {#1} {#2} }
\cs_new_protected:Npn \zhnum_set_financial_map:nnn #1#2#3
  {
    \prop_put_if_new:Nnn \l_@@_cfg_map_finan_prop {#1} {#3}
    \prop_put:Nnn \l_@@_cfg_map_var_prop { financial_#1_#2 } {#3}
  }
\prop_new:N \l_@@_cfg_map_prop
\prop_new:N \l_@@_cfg_map_var_prop
\prop_new:N \l_@@_cfg_map_finan_prop
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%   {
%     \zhnum_parse_config:,
%     \zhnum_check_simp:nn,
%     \zhnum_check_financial:nn,
%     \zhnum_set_zero:,
%     \zhnum_set_week_day:
%   }
% å°† \texttt{prop} è¡¨è½¬åŒ–åˆ°å•ç‹¬çš„ \texttt{tl} å˜é‡ã€‚
%    \begin{macrocode}
\cs_new_protected_nopar:Npn \zhnum_parse_config:
  {
    \prop_map_function:NN \l_@@_cfg_map_prop \zhnum_check_simp:nn
    \zhnum_set_zero:
    \zhnum_set_week_day:
    \bool_if:NF \l_@@_reset_bool
      {
        \zhnum_assgin_const:
        \bool_set_true:N \l_@@_reset_bool
      }
  }
\cs_new_protected:Npn \zhnum_check_simp:nn #1#2
  {
    \@@_check_simp_aux:nn {#2} {#1}
    \prop_get:NnNT \l_@@_cfg_map_finan_prop {#1} \l_tmpa_tl
      { \exp_args:No \@@_check_simp_aux:nn { \l_tmpa_tl } { financial_ #1 } }
  }
\cs_new_protected:Npn \@@_check_simp_aux:nn #1#2
  {
    \prop_get:NnNTF \l_@@_cfg_map_var_prop { #2 _trad } \l_tmpa_tl
      {
        \prop_get:NnNF \l_@@_cfg_map_var_prop { #2 _simp } \l_tmpb_tl
          { \tl_set:Nn \l_tmpb_tl {#1} }
        \tl_set:cx { l_@@_ #2 _tl }
          {
            \exp_not:n { \bool_if:NTF \l_@@_simp_bool }
              { \exp_not:o \l_tmpb_tl } { \exp_not:o \l_tmpa_tl }
          }
      }
      { \tl_set:cn { l_@@_ #2 _tl } {#1} }
  }
\cs_new_protected_nopar:Npn \zhnum_assgin_const:
  {
    \prop_map_function:NN \l_@@_cfg_map_prop \zhnum_check_financial:nn
    \zhnum_set_alias:
  }
\cs_new_protected:Npn \zhnum_check_financial:nn #1#2
  {
    \prop_get:NnNTF \l_@@_cfg_map_finan_prop {#1} \l_tmpa_tl
      {
        \zhnum_assgin_const_tl:cx { c_@@_ #1 _tl }
          {
            \exp_not:n { \bool_if:NTF \l_@@_normal_bool }
              { \exp_not:c { l_@@_ #1 _tl } }
              { \exp_not:c { l_@@_financial_ #1 _tl } }
          }
      }
      {
        \zhnum_assgin_const_tl:cx
          { c_@@_ #1 _tl } { \exp_not:c { l_@@_ #1 _tl } }
      }
  }
\cs_new_protected_nopar:Npn \zhnum_set_zero:
  {
    \tl_set:cx { l_@@_0_tl }
      {
        \exp_not:n { \bool_if:NTF \l_@@_null_bool }
          { \exp_not:o \l_@@_null_tl } { \exp_not:v { l_@@_0_tl } }
      }
  }
\cs_new_protected_nopar:Npn \zhnum_set_week_day:
  {
    \tl_set:Nx \l_@@_mon_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:v { l_@@_1_tl } }
    \tl_set:Nx \l_@@_tue_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:v { l_@@_2_tl } }
    \tl_set:Nx \l_@@_wed_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:v { l_@@_3_tl } }
    \tl_set:Nx \l_@@_thu_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:v { l_@@_4_tl } }
    \tl_set:Nx \l_@@_fri_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:v { l_@@_5_tl } }
    \tl_set:Nx \l_@@_sat_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:v { l_@@_6_tl } }
    \tl_set:Nx \l_@@_sun_tl
      { \exp_not:N \c_@@_weekday_tl \exp_not:o \l_@@_day_tl }
  }
\clist_map_inline:nn { mon , tue , wed , thu , fri , sat , sun }
  { \tl_const:cx { c_@@_ #1 _tl } { \exp_not:c { l_@@_ #1 _tl } } }
\cs_new_eq:NN \zhnum_assgin_const_tl:cx \tl_const:cx
\AtEndOfPackage
  { \cs_set_eq:NN \zhnum_assgin_const_tl:cx \tl_set:cx }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_set_alias:}
% ä¸€äº›æ˜“äºŽä½¿ç”¨çš„åˆ«åã€‚
%    \begin{macrocode}
\cs_new_eq:NN \zhnum_set_alias:NN \cs_new_eq:NN
\cs_new_protected_nopar:Npx \zhnum_set_alias:
  {
    \zhnum_set_alias:NN \exp_not:N \c_@@_zero_tl
                        \exp_not:c { c_@@_ 0 _tl }
    \zhnum_set_alias:NN \exp_not:N \c_@@_ten_tl
                        \exp_not:c { c_@@_ 10 _tl }
    \zhnum_set_alias:NN \exp_not:N \c_@@_hundred_tl
                        \exp_not:c { c_@@_ 100 _tl }
    \zhnum_set_alias:NN \exp_not:N \c_@@_thousand_tl
                        \exp_not:c { c_@@_ 1000 _tl }
  }
\AtEndOfPackage
  { \cs_set_eq:NN \zhnum_set_alias:NN \tl_set_eq:NN }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]{\zhnum_load_cfg:n}
% æ&nbsp;¹æ®é€‰å®šç¼–ç&nbsp;è½½å…¥é…ç½®æ–‡ä»¶ã€‚
%    \begin{macrocode}
\cs_new_protected:Npn \zhnum_load_cfg:n #1
  {
    \zhnum_set_cfg_name:Nn \l_@@_cfg_tl {#1}
    \tl_if_eq:NNF \l_@@_cfg_tl \l_@@_last_cfg_tl
      { \zhnum_update_cfg:n {#1} }
    \zhnum_parse_config:
  }
\cs_generate_variant:Nn \zhnum_load_cfg:n { o }
\cs_new_protected:Npn \zhnum_update_cfg:n #1
  {
    \prop_if_exist:cTF { g_@@_cfg_ \l_@@_cfg_tl _prop }
      { \tl_set_eq:NN \l_@@_last_cfg_tl \l_@@_cfg_tl }
      { \zhnum_input_cfg:n  {#1} }
    \@@_update_cfg_prop:N \prop_set_eq:Nc
  }
\cs_new_protected:Npn \zhnum_input_cfg:n #1
  {
    \file_if_exist_input:nTF { zhnumber - #1 .cfg }
      {
        \bool_set_false:N \l_@@_reset_bool
        \@@_update_cfg_prop:N \@@_prop_initial:Nn
        \group_begin:
          \zhnum_set_catcode:
      }
      {
        \msg_error:nnx { zhnumber } { file-not-found } {#1}
        \use_none:nnn
      }
    \@@_update_cfg_prop:N \@@_prop_gset_eq:Nn
    \group_end:
  }
\cs_new_protected:Npn \@@_update_cfg_prop:N #1
  {
    #1 \l_@@_cfg_map_prop       { g_@@_cfg_ \l_@@_cfg_tl _prop }
    #1 \l_@@_cfg_map_var_prop   { g_@@_cfg_var_ \l_@@_cfg_tl _prop }
    #1 \l_@@_cfg_map_finan_prop { g_@@_cfg_finan_ \l_@@_cfg_tl _prop }
  }
\cs_new_protected:Npn \@@_prop_initial:Nn #1#2
  {
    \prop_clear:N #1
    \prop_new:c {#2}
  }
\cs_new_protected:Npn \@@_prop_gset_eq:Nn #1#2
  { \prop_gset_eq:cN {#2} #1 }
\tl_new:N \l_@@_cfg_tl
\tl_new:N \l_@@_last_cfg_tl
\bool_new:N \l_@@_reset_bool
\msg_new:nnnn  { zhnumber } { file-not-found }
  { File~`#1'~not~found. }
  {
    The~requested~file~could~not~be~found~in~the~current~directory,~
    in~the~TeX~search~path~or~in~the~LaTeX~search~path.
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal,pTF]{\zhnum_if_unicode_engine:}
% ä½¿ç”¨ \upTeX{} çš„æ—¶å€™ï¼Œä¹Ÿä¸å¿…å°†æ±‰å­—çš„é¦–å­—ç¬¦è®¾ç½®ä¸ºæ´»åŠ¨å­—ç¬¦ã€‚åˆ¤æ–­ |^^^^0021| æ˜¯å¦ä¸º
% å•ä¸ªè®°å·çš„åŠžæ³•å¯¹ \upTeX{} ä¸é€‚ç”¨ã€‚å›&nbsp;æ­¤ï¼Œå‚è€ƒ \pkg{ifuptex} å®åŒ…ï¼Œé€šè¿‡ \tn{kchar}
% æ˜¯å¦ä¸º primitive æ¥åˆ¤æ–­ã€‚
%    \begin{macrocode}
\pdftex_if_engine:TF
  {
    \str_if_eq_x:nnTF
      { \token_to_str:N \kchar }
      { \token_to_meaning:N \kchar }
  }
  { \use_i:nn }
  {
    \cs_new_eq:NN \zhnum_if_unicode_engine_p: \c_true_bool
    \cs_new_eq:NN \zhnum_if_unicode_engine:TF \use_i:nn
  }
  {
    \cs_new_eq:NN \zhnum_if_unicode_engine_p: \c_false_bool
    \cs_new_eq:NN \zhnum_if_unicode_engine:TF \use_ii:nn
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}[internal]
%   {
%     \zhnum_set_catcode:,
%     \zhnum_set_cfg_name:Nn,
%     \zhnum_reset_config:
%   }
% è®¾ç½®ä¸Žæ¢å¤é…ç½®æ–‡ä»¶å‰åŽçš„ catcodeã€‚\pdfLaTeX{} éœ€è¦å°†æ±‰å­—çš„é¦–å­—èŠ‚è®¾ç½®ä¸ºæ´»åŠ¨å­—ç¬¦ã€‚
%    \begin{macrocode}
\if_predicate:w \zhnum_if_unicode_engine_p:
  \cs_new_eq:NN \zhnum_set_catcode: \prg_do_nothing:
  \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2
    {
      \tl_set:Nx \l_@@_encoding_tl {#2}
      \tl_set:Nx #1 { \tl_to_str:N \l_@@_encoding_tl }
    }
  \cs_new_eq:NN \zhnum_reset_config: \zhnum_parse_config:
\else:
  \cs_new_protected_nopar:Npn \zhnum_set_catcode:
    { \bool_if:NT \l_@@_active_char_bool { \zhnum_set_active: } }
  \cs_new_protected_nopar:Npn \zhnum_set_active:
    {
      \str_case:onTF { \l_@@_encoding_tl }
        {
          { gbk }  { \int_set:Nn \l_@@_byte_min_int { "81 } }
          { big5 } { \int_set:Nn \l_@@_byte_min_int { "A1 } }
        }
        { \int_set:Nn \l_@@_byte_max_int { "FE } }
        {
          \int_set:Nn \l_@@_byte_min_int { "E0 }
          \int_set:Nn \l_@@_byte_max_int { "EF }
        }
      \int_step_function:nnnN
        { \l_@@_byte_min_int } { \c_one }
        { \l_@@_byte_max_int } \char_set_catcode_active:n
    }
  \int_new:N \l_@@_byte_min_int
  \int_new:N \l_@@_byte_max_int
  \cs_new_protected:Npn \zhnum_set_cfg_name:Nn #1#2
    {
      \tl_set:Nx \l_@@_encoding_tl {#2}
      \tl_set:Nx #1
        {
          \tl_to_str:N \l_@@_encoding_tl
          \bool_if:NT \l_@@_active_char_bool
            { \tl_to_str:n { _active } }
        }
    }
  \cs_new_protected_nopar:Npn \zhnum_reset_config:
    { \zhnum_load_cfg:o { \l_@@_encoding_tl } }
  \bool_new:N \l_@@_active_char_bool
  \bool_set_true:N \l_@@_active_char_bool
\fi:
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{encoding,style,null,reset}
% å®åŒ…è®¾ç½®é€‰é¡¹ã€‚
%    \begin{macrocode}
\keys_define:nn { zhnum / options }
  {
    encoding         .choices:nn =
      { UTF8 , GBK , Big5 }
      {
        \tl_set:Nx \l_@@_encoding_tl
          { \exp_args:No \tl_expandable_lowercase:n { \l_keys_choice_tl } }
        \zhnum_load_cfg:o { \l_@@_encoding_tl }
      } ,
    encoding          .default:n = { GBK } ,
    encoding / Bg5       .meta:n = { encoding = Big5 } ,
    encoding / unknown   .code:n =
      { \msg_error:nnn { zhnumber } { encoding-invalid } {#1} } ,
    style .multichoice: ,
    style / Normal       .code:n =
      {
        \bool_set_false:N \l_@@_ancient_bool
        \bool_set_true:N  \l_@@_normal_bool
      } ,
    style / Financial    .code:n =
      {
        \bool_set_false:N \l_@@_ancient_bool
        \bool_set_false:N \l_@@_normal_bool
      } ,
    style / Ancient      .code:n =
      {
        \bool_set_true:N \l_@@_ancient_bool
        \bool_set_true:N \l_@@_normal_bool
      } ,
    style / Simplified   .code:n = { \bool_set_true:N  \l_@@_simp_bool } ,
    style / Traditional  .code:n = { \bool_set_false:N \l_@@_simp_bool } ,
    style             .default:n = { Normal , Simplified } ,
    null             .bool_set:N = \l_@@_null_bool ,
    time .choice: ,
    time / Chinese       .code:n = { \bool_set_true:N \l_@@_time_bool } ,
    time / Arabic        .code:n = { \bool_set_false:N  \l_@@_time_bool } ,
    time              .default:n = { Arabic } ,
    reset                .code:n = { \zhnum_reset_config: } ,
    activechar       .bool_set:N = \l_@@_active_char_bool ,
  }
\tl_new:N \l_@@_encoding_tl
\msg_new:nnnn { zhnumber } { encoding-invalid }
  { The~encoding~`#1'~is~invalid. }
  { Available~encodings~are~`UTF8',~`GBK'~and~`Big5'. }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\zhnumsetup}
% åœ¨æ–‡æ¡£ä¸­è®¾ç½® \pkg{zhnumber} çš„æŽ¥å£ã€‚
%    \begin{macrocode}
\NewDocumentCommand \zhnumsetup { +m }
  {
    \keys_set:nn { zhnum / options } {#1}
    \tex_ignorespaces:D
  }
%    \end{macrocode}
% \end{macro}
%
% åˆå§‹åŒ–è®¾ç½®å’Œæ‰§è¡Œå®åŒ…é€‰é¡¹ã€‚
%    \begin{macrocode}
\keys_set:nn { zhnum / options } { style , time }
\ProcessKeysOptions { zhnum / options }
%    \end{macrocode}
%
% å¦‚æžœæ²¡æœ‰é€‰å®šç¼–ç&nbsp;ï¼Œåˆ™æ&nbsp;¹æ®å¼•æ“Žè‡ªåŠ¨è®¾ç½®ç¼–ç&nbsp;ã€‚
%    \begin{macrocode}
\tl_if_empty:NT \l_@@_encoding_tl
  {
    \zhnum_if_unicode_engine:TF
      { \keys_set:nn { zhnum / options } { encoding = UTF8 } }
      { \keys_set:nn { zhnum / options } { encoding = GBK } }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;/package&gt;
%    \end{macrocode}
%
% \section{ä¸­æ–‡æ•°å­—é…ç½®æ–‡ä»¶}
% \label{sec:zhnum-map}
%
%    \begin{macrocode}
%&lt;*config&gt;
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;*!big5&gt;
\zhnum_set_digits_map:nnn { minus } { simp } { è´Ÿ }
\zhnum_set_digits_map:nnn { minus } { trad } { è²&nbsp; }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { minus } { è²&nbsp; }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { 0 }     { é›¶ }
%&lt;*!big5&gt;
\zhnum_set_digits_map:nn { null }  { ã€‡ }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { null }  { â—‹ }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { 1 }     { ä¸€ }
\zhnum_set_digits_map:nn { 2 }     { äºŒ }
\zhnum_set_digits_map:nn { 3 }     { ä¸‰ }
\zhnum_set_digits_map:nn { 4 }     { å›› }
\zhnum_set_digits_map:nn { 5 }     { äº” }
\zhnum_set_digits_map:nn { 6 }     { å…­ }
\zhnum_set_digits_map:nn { 7 }     { ä¸ƒ }
\zhnum_set_digits_map:nn { 8 }     { å…« }
\zhnum_set_digits_map:nn { 9 }     { ä¹ }
\zhnum_set_digits_map:nn { 10 }    { å }
\zhnum_set_digits_map:nn { 100 }   { ç™¾ }
\zhnum_set_digits_map:nn { 1000 }  { åƒ }
\zhnum_set_digits_map:nn { 20 }    { å»¿ }
\zhnum_set_digits_map:nn { 30 }    { å… }
\zhnum_set_digits_map:nn { 40 }    { åŒ }
\zhnum_set_digits_map:nn { 200 }   { çš• }
%&lt;*!big5&gt;
\zhnum_set_digits_map:nnn { dot } { simp } { ç‚¹ }
\zhnum_set_digits_map:nnn { dot } { trad } { é»ž }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { dot }   { é»ž }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { and }   { åˆ }
\zhnum_set_digits_map:nn { parts } { åˆ†ä¹‹ }
%&lt;*!big5&gt;
\zhnum_set_digits_map:nnn { s1 }    { simp } { ä¸‡ }
\zhnum_set_digits_map:nnn { s1 }    { trad } { è¬ }
\zhnum_set_digits_map:nnn { s2 }    { simp } { äº¿ }
\zhnum_set_digits_map:nnn { s2 }    { trad } { å„„ }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { s1 }    { è¬ }
\zhnum_set_digits_map:nn { s2 }    { å„„ }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { s3 }    { å…† }
\zhnum_set_digits_map:nn { s4 }    { äº¬ }
\zhnum_set_digits_map:nn { s5 }    { åž“ }
\zhnum_set_digits_map:nn { s6 }    { ç§­ }
\zhnum_set_digits_map:nn { s7 }    { ç©° }
%&lt;*!big5&gt;
\zhnum_set_digits_map:nnn { s8 }    { simp } { æ²Ÿ }
\zhnum_set_digits_map:nnn { s8 }    { trad } { æº }
\zhnum_set_digits_map:nnn { s9 }    { simp } { æ¶§ }
\zhnum_set_digits_map:nnn { s9 }    { trad } { æ¾— }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { s8 }    { æº }
\zhnum_set_digits_map:nn { s9 }    { æ¾— }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { s10 }   { æ­£ }
%&lt;*!big5&gt;
\zhnum_set_digits_map:nnn { s11 }   { simp } { è½½ }
\zhnum_set_digits_map:nnn { s11 }   { trad } { è¼‰ }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { s11 }   { è¼‰ }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { year }  { å¹´ }
\zhnum_set_digits_map:nn { month } { æœˆ }
\zhnum_set_digits_map:nn { day }   { æ—¥ }
%&lt;*!big5&gt;
\zhnum_set_digits_map:nnn { hour }  { simp } { æ—¶ }
\zhnum_set_digits_map:nnn { hour }  { trad } { æ™‚ }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_digits_map:nn { hour }  { æ™‚ }
%&lt;/big5&gt;
\zhnum_set_digits_map:nn { minute }  { åˆ† }
\zhnum_set_digits_map:nn { weekday } { æ˜ŸæœŸ }
\zhnum_set_financial_map:nn { null } { é›¶ }
\zhnum_set_financial_map:nn { 0 }    { é›¶ }
\zhnum_set_financial_map:nn { 1 }    { å£¹ }
\zhnum_set_financial_map:nn { 2 }    { è²³ }
%&lt;*!big5&gt;
\zhnum_set_financial_map:nnn { 3 }  { simp } { å }
\zhnum_set_financial_map:nnn { 3 }  { trad } { å„ }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_financial_map:nn { 3 }    { åƒ }
%&lt;/big5&gt;
\zhnum_set_financial_map:nn { 4 }    { è‚† }
\zhnum_set_financial_map:nn { 5 }    { ä¼ }
%&lt;*!big5&gt;
\zhnum_set_financial_map:nnn { 6 }  { simp } { é™† }
\zhnum_set_financial_map:nnn { 6 }  { trad } { é™¸ }
%&lt;/!big5&gt;
%&lt;*big5&gt;
\zhnum_set_financial_map:nn { 6 }    { é™¸ }
%&lt;/big5&gt;
\zhnum_set_financial_map:nn { 7 }    { æŸ’ }
\zhnum_set_financial_map:nn { 8 }    { æŒ }
\zhnum_set_financial_map:nn { 9 }    { çŽ– }
\zhnum_set_financial_map:nn { 10 }   { æ‹¾ }
\zhnum_set_financial_map:nn { 100 }  { ä½° }
\zhnum_set_financial_map:nn { 1000 } { ä»Ÿ }
%    \end{macrocode}
%
%    \begin{macrocode}
%&lt;/config&gt;
%    \end{macrocode}
%
% \end{implementation}
%
% \Finale
%
\endinput
</pre></body></html>