summaryrefslogtreecommitdiff
path: root/language/chinese/CJK/cjk-4.8.5/texinput/CJKnumb.sty
diff options
context:
space:
mode:
Diffstat (limited to 'language/chinese/CJK/cjk-4.8.5/texinput/CJKnumb.sty')
-rw-r--r--language/chinese/CJK/cjk-4.8.5/texinput/CJKnumb.sty400
1 files changed, 400 insertions, 0 deletions
diff --git a/language/chinese/CJK/cjk-4.8.5/texinput/CJKnumb.sty b/language/chinese/CJK/cjk-4.8.5/texinput/CJKnumb.sty
new file mode 100644
index 0000000000..61c928cf14
--- /dev/null
+++ b/language/chinese/CJK/cjk-4.8.5/texinput/CJKnumb.sty
@@ -0,0 +1,400 @@
+% This is the file CJKnumb.sty of the CJK package
+% for typesetting numbers with CJK glyphs.
+%
+% created by Werner Lemberg <wl@gnu.org>
+%
+% Version 4.8.5 (16-Oct-2021)
+
+% Copyright (C) 1994-2021 Werner Lemberg <wl@gnu.org>
+%
+% This program is free software; you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation; either version 2 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program in doc/COPYING; if not, write to the Free
+% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+% MA 02110-1301 USA
+
+\def\fileversion{4.8.5}
+\def\filedate{2021/10/16}
+\ProvidesPackage{CJKnumb}[\filedate\space\fileversion]
+
+\RequirePackage{CJK}[2021/10/16]
+
+
+% we suppress any unwanted spaces produced by linefeeds.
+
+\endlinechar \m@ne
+
+
+% the amount of space to be inserted before and after the circle
+% representing zero
+
+\def\CJKnullspace{0pt}
+
+
+% generic number macros. We add them to the CJK encoding hooks.
+
+\def\CJK@traditionalNumbers{
+ % circle used for zero
+ \def\CJK@null{\kern\CJKnullspace\CJKchar{161}{179}\kern\CJKnullspace}
+ % character used for zero
+ \def\CJK@zero{\CJKchar{185}{115}}
+ \def\CJK@one{\CJKchar{164}{64}}
+ \def\CJK@two{\CJKchar{164}{71}}
+ \def\CJK@three{\CJKchar{164}{84}}
+ \def\CJK@four{\CJKchar{165}{124}}
+ \def\CJK@five{\CJKchar{164}{173}}
+ \def\CJK@six{\CJKchar{164}{187}}
+ \def\CJK@seven{\CJKchar{164}{67}}
+ \def\CJK@eight{\CJKchar{164}{75}}
+ \def\CJK@nine{\CJKchar{164}{69}}
+ \def\CJK@ten{\CJKchar{164}{81}}
+ \def\CJK@hundred{\CJKchar{166}{202}}
+ \def\CJK@thousand{\CJKchar{164}{100}}
+ \def\CJK@tenthousand{\CJKchar{184}{85}}
+ \def\CJK@hundredmillion{\CJKchar{187}{245}}
+
+ \def\CJK@minus{\CJKchar{161}{208}}}
+
+\CJKaddEncHook{Bg5}{\CJK@traditionalNumbers}
+\CJKaddEncHook{Bg5+}{\CJK@traditionalNumbers}
+\CJKaddEncHook{HK}{\CJK@traditionalNumbers}
+
+\def\CJK@simplifiedNumbers{
+ \def\CJK@null{\kern\CJKnullspace\CJKchar{161}{240}\kern\CJKnullspace}
+ \def\CJK@zero{\CJKchar{193}{227}}
+ \def\CJK@one{\CJKchar{210}{187}}
+ \def\CJK@two{\CJKchar{182}{254}}
+ \def\CJK@three{\CJKchar{200}{253}}
+ \def\CJK@four{\CJKchar{203}{196}}
+ \def\CJK@five{\CJKchar{206}{229}}
+ \def\CJK@six{\CJKchar{193}{249}}
+ \def\CJK@seven{\CJKchar{198}{223}}
+ \def\CJK@eight{\CJKchar{176}{203}}
+ \def\CJK@nine{\CJKchar{190}{197}}
+ \def\CJK@ten{\CJKchar{202}{174}}
+ \def\CJK@hundred{\CJKchar{176}{217}}
+ \def\CJK@thousand{\CJKchar{199}{167}}
+ \def\CJK@tenthousand{\CJKchar{205}{242}}
+ \def\CJK@hundredmillion{\CJKchar{210}{218}}
+
+ \def\CJK@minus{\CJKchar{163}{173}}}
+
+\CJKaddEncHook{GB}{\CJK@simplifiedNumbers}
+\CJKaddEncHook{GBK}{\CJK@simplifiedNumbers}
+
+\CJKaddEncHook{JIS}{
+ \def\CJK@null{\kern\CJKnullspace\CJKchar{161}{251}\kern\CJKnullspace}
+ \def\CJK@zero{\CJKchar{206}{237}}
+ \def\CJK@one{\CJKchar{176}{236}}
+ \def\CJK@two{\CJKchar{198}{243}}
+ \def\CJK@three{\CJKchar{187}{176}}
+ \def\CJK@four{\CJKchar{187}{205}}
+ \def\CJK@five{\CJKchar{184}{222}}
+ \def\CJK@six{\CJKchar{207}{187}}
+ \def\CJK@seven{\CJKchar{188}{183}}
+ \def\CJK@eight{\CJKchar{200}{172}}
+ \def\CJK@nine{\CJKchar{182}{229}}
+ \def\CJK@ten{\CJKchar{189}{189}}
+ \def\CJK@hundred{\CJKchar{201}{180}}
+ \def\CJK@thousand{\CJKchar{192}{233}}
+ \def\CJK@tenthousand{\CJKchar{232}{223}}
+ \def\CJK@hundredmillion{\CJKchar{178}{175}}
+
+ \def\CJK@minus{\CJKchar{161}{221}}}
+
+\CJKaddEncHook{KS}{
+ \def\CJK@null{\kern\CJKnullspace\CJKchar{161}{219}\kern\CJKnullspace}
+ \def\CJK@zero{\CJKchar{214}{195}}
+ \def\CJK@one{\CJKchar{236}{233}}
+ \def\CJK@two{\CJKchar{236}{163}}
+ \def\CJK@three{\CJKchar{223}{178}}
+ \def\CJK@four{\CJKchar{222}{204}}
+ \def\CJK@five{\CJKchar{231}{233}}
+ \def\CJK@six{\CJKchar{215}{191}}
+ \def\CJK@seven{\CJKchar{246}{210}}
+ \def\CJK@eight{\CJKchar{248}{162}}
+ \def\CJK@nine{\CJKchar{206}{250}}
+ \def\CJK@ten{\CJKchar{228}{168}}
+ \def\CJK@hundred{\CJKchar{219}{221}}
+ \def\CJK@thousand{\CJKchar{244}{182}}
+ \def\CJK@tenthousand{\CJKchar{216}{191}}
+ \def\CJK@hundredmillion{\CJKchar{229}{226}}
+
+ \def\CJK@minus{\CJKchar{163}{173}}}
+
+\CJKaddEncHook{SJIS}{
+ \def\CJK@null{\kern\CJKnullspace\CJKchar{129}{155}\kern\CJKnullspace}
+ \def\CJK@zero{\CJKchar{151}{235}}
+ \def\CJK@one{\CJKchar{136}{234}}
+ \def\CJK@two{\CJKchar{147}{241}}
+ \def\CJK@three{\CJKchar{142}{79}}
+ \def\CJK@four{\CJKchar{142}{108}}
+ \def\CJK@five{\CJKchar{140}{220}}
+ \def\CJK@six{\CJKchar{152}{90}}
+ \def\CJK@seven{\CJKchar{142}{181}}
+ \def\CJK@eight{\CJKchar{148}{170}}
+ \def\CJK@nine{\CJKchar{139}{227}}
+ \def\CJK@ten{\CJKchar{143}{92}}
+ \def\CJK@hundred{\CJKchar{149}{83}}
+ \def\CJK@thousand{\CJKchar{144}{231}}
+ \def\CJK@tenthousand{\CJKchar{228}{221}}
+ \def\CJK@hundredmillion{\CJKchar{137}{173}}
+
+ \def\CJK@minus{\CJKchar{129}{124}}}
+
+\CJKaddEncHook{\CJK@UnicodeEnc}{
+ \def\CJK@null{\Unicode{48}{7}}
+ \def\CJK@zero{\Unicode{150}{246}}
+ \def\CJK@one{\Unicode{78}{0}}
+ \def\CJK@two{\Unicode{78}{140}}
+ \def\CJK@three{\Unicode{78}{9}}
+ \def\CJK@four{\Unicode{86}{219}}
+ \def\CJK@five{\Unicode{78}{148}}
+ \def\CJK@six{\Unicode{81}{109}}
+ \def\CJK@seven{\Unicode{78}{3}}
+ \def\CJK@eight{\Unicode{81}{107}}
+ \def\CJK@nine{\Unicode{78}{93}}
+ \def\CJK@ten{\Unicode{83}{65}}
+ \def\CJK@hundred{\Unicode{118}{126}}
+ \def\CJK@thousand{\Unicode{83}{67}}
+ \def\CJK@tenthousand{\Unicode{132}{44}}
+ \def\CJK@hundredmillion{\Unicode{81}{4}}
+
+ \def\CJK@minus{\Unicode{255}{13}}}
+
+
+\newif\ifCJK@zero@
+\newif\ifCJK@previous@
+
+\newif\ifCJK@null@
+
+
+\newcount\CJK@q
+\newcount\CJK@r
+
+
+\def\CJK@digit#1{
+ \ifcase #1\relax
+ \ifCJK@null@ \CJK@null \else \CJK@zero \fi \or
+ \CJK@one \or
+ \CJK@two \or
+ \CJK@three \or
+ \CJK@four \or
+ \CJK@five \or
+ \CJK@six \or
+ \CJK@seven \or
+ \CJK@eight \or
+ \CJK@nine
+ \fi}
+
+
+% This macro splits the number in zzyyyyxxxx (2^^31-1 is the largest
+% possible integer in TeX); zz is \CJK@yi, yyyy is \CJK@high, and
+% xxxx is \CJK@low.
+
+\def\CJK@splitnumber#1{
+ \CJK@q #1
+ \CJK@r #1
+
+ \divide\CJK@q \@M
+ \begingroup
+ \multiply\CJK@q \@M
+ \advance\CJK@r -\CJK@q
+ \ifnum\CJK@r = \z@
+ \xdef\CJK@low{}
+ \else
+ \xdef\CJK@low{\number\CJK@r}
+ \fi
+ \endgroup
+
+ \ifnum\CJK@q > \z@
+ \CJK@r \CJK@q
+
+ \divide\CJK@q \@M
+ \begingroup
+ \multiply\CJK@q \@M
+ \advance\CJK@r -\CJK@q
+ \ifnum\CJK@r = \z@
+ \xdef\CJK@high{}
+ \else
+ \xdef\CJK@high{\number\CJK@r}
+ \fi
+ \endgroup
+
+ \ifnum\CJK@q > \z@
+ \xdef\CJK@yi{\number\CJK@q}
+ \else
+ \xdef\CJK@yi{}
+ \fi
+ \else
+ \xdef\CJK@high{}
+ \xdef\CJK@yi{}
+ \fi
+}
+
+% Here we process four digits
+
+\def\CJK@processnumber#1{
+ \CJK@zero@false
+
+ \CJK@q #1
+ \CJK@r #1
+
+ \divide\CJK@q \@m
+ \ifnum\CJK@q = \z@
+ \ifCJK@previous@
+ \CJK@zero@true
+ \fi
+ \else
+ \ifCJK@zero@
+ \CJK@zero
+ \fi
+ \CJK@digit{\CJK@q}
+ \CJK@thousand
+ \CJK@previous@true
+ \CJK@zero@false
+ \fi
+
+ \multiply\CJK@q \@m
+ \advance\CJK@r -\CJK@q
+ \CJK@q \CJK@r
+
+ \divide\CJK@q 100\relax
+ \ifnum\CJK@q = \z@
+ \ifCJK@previous@
+ \CJK@zero@true
+ \fi
+ \else
+ \ifCJK@zero@
+ \CJK@zero
+ \fi
+ \CJK@digit{\CJK@q}
+ \CJK@hundred
+ \CJK@previous@true
+ \CJK@zero@false
+ \fi
+
+ \multiply\CJK@q 100
+ \advance\CJK@r -\CJK@q
+ \CJK@q \CJK@r
+
+ \divide \CJK@q 10\relax
+ \ifnum\CJK@q = \z@
+ \ifCJK@previous@
+ \CJK@zero@true
+ \fi
+ \else
+ \ifCJK@zero@
+ \CJK@zero
+ \fi
+ \ifnum\CJK@q = \@ne
+ \ifCJK@previous@
+ \CJK@one
+ \fi
+ \else
+ \CJK@digit{\CJK@q}
+ \fi
+ \CJK@ten
+ \CJK@previous@true
+ \CJK@zero@false
+ \fi
+
+ \multiply\CJK@q 10
+ \advance\CJK@r -\CJK@q
+
+ \ifnum\CJK@r = \z@
+ \else
+ \ifCJK@zero@
+ \CJK@zero
+ \fi
+ \CJK@digit{\CJK@r}
+ \CJK@previous@true
+ \fi
+}
+
+
+% this command provides a full CJK representation of a number.
+
+\DeclareRobustCommand\CJKnumber[1]{
+ \CJK@null@false
+
+ \CJK@q #1\relax
+
+ \ifnum\CJK@q < \z@
+ \multiply\CJK@q \m@ne
+ \CJK@minus
+ \CJKkern
+ \fi
+
+ \CJK@previous@false
+ \CJK@zero@false
+
+ \ifnum\CJK@q = \z@
+ \CJK@zero
+ \else
+ \CJK@splitnumber{\CJK@q}
+
+ \ifx\CJK@yi \@empty
+ \else
+ \CJK@processnumber{\CJK@yi}
+ \CJK@hundredmillion
+ \fi
+
+ \ifx\CJK@high \@empty
+ \else
+ \CJK@processnumber{\CJK@high}
+ \CJK@tenthousand
+ \fi
+
+ \ifx\CJK@low \@empty
+ \else
+ \ifx\CJK@yi \@empty
+ \else
+ \ifx\CJK@high \@empty
+ \CJK@zero % this catches 100002345
+ \fi
+ \fi
+ \CJK@processnumber{\CJK@low}
+ \fi
+ \fi}
+
+
+% this command simply converts the given string into CJK digits;
+% the starred version uses the traditional glyph for digit zero.
+
+\DeclareRobustCommand\CJKdigits{
+ \@ifstar{\CJK@null@false\CJK@digits}
+ {\CJK@null@true\CJK@digits}}
+
+\def\CJK@digits#1{
+ {\edef\CJK@tempa{}
+ \edef\CJK@tempb{#1}
+ \ifx\CJK@tempb \@empty
+ \else
+ \loop
+ \expandafter\CJK@getDigit\CJK@tempb\CJK@stop
+ \CJK@digit\CJK@tempa
+ \ifx\CJK@tempb \@empty
+ \else
+ \repeat
+ \fi}}
+
+\def\CJK@getDigit#1#2\CJK@stop{
+ \edef\CJK@tempa{#1}
+ \edef\CJK@tempb{#2}}
+
+
+% reset endline character.
+
+\endlinechar `\^^M
+
+\endinput