diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/numnameru/numnameru.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/numnameru/numnameru.sty | 435 |
1 files changed, 435 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/numnameru/numnameru.sty b/Master/texmf-dist/tex/latex/numnameru/numnameru.sty new file mode 100644 index 00000000000..3f89027e210 --- /dev/null +++ b/Master/texmf-dist/tex/latex/numnameru/numnameru.sty @@ -0,0 +1,435 @@ +% -*- mode: latex; coding: utf-8 -*- +%% +%% This is file is `numnameru.sty' by Vit. 2012--2017 +%% +%% This file based on `numname.sty' +%% Authors of `numname.sty': +%% Peter Wilson (herries dot press at earthlink dot net) +%% Herries Press +%% Copyright 2001--2005 Peter R. Wilson +%% and +%% S Joshua Swamidass +%% +%% 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 the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Warning! +%% max number to convert - 2'147'483'647 +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ProvidesPackage{numnameru} +% Логические переменные +\newif\ifpriornum +\newif\ifminusnumber +% +\newcommand*{\minusname}{минус } +% Единицы +\newcommand*{\rNamenumberO}{ноль} +\newcommand*{\rNamenumberI}{один} +\newcommand*{\rNamenumberII}{два} +\newcommand*{\rNamenumberIII}{три} +\newcommand*{\rNamenumberIV}{четыре} +\newcommand*{\rNamenumberV}{пять} +\newcommand*{\rNamenumberVI}{шесть} +\newcommand*{\rNamenumberVII}{семь} +\newcommand*{\rNamenumberVIII}{восемь} +\newcommand*{\rNamenumberIX}{девять} +% +\newcommand*{\rNamenumberX}{десять} +% первый десяток +\newcommand*{\rNamenumberXI}{одиннадцать} +\newcommand*{\rNamenumberXII}{двенадцать} +\newcommand*{\rNamenumberXIII}{тринадцать} +\newcommand*{\rNamenumberXIV}{четырнадцать} +\newcommand*{\rNamenumberXV}{пятнадцать} +\newcommand*{\rNamenumberXVI}{шестнадцать} +\newcommand*{\rNamenumberXVII}{семнадцать} +\newcommand*{\rNamenumberXVIII}{восемнадцать} +\newcommand*{\rNamenumberXIX}{девятнадцать} +% Десятки +\newcommand*{\rNamenumberIID}{двадцать} +\newcommand*{\rNamenumberIIID}{тридцать} +\newcommand*{\rNamenumberIVD}{сорок} +\newcommand*{\rNamenumberVD}{пятьдесят} +\newcommand*{\rNamenumberVID}{шестьдесят} +\newcommand*{\rNamenumberVIID}{семьдесят} +\newcommand*{\rNamenumberVIIID}{восемьдесят} +\newcommand*{\rNamenumberIXD}{девяносто} +% Сотни +\newcommand*{\rNamenumberC}{сто} +\newcommand*{\rNamenumberIIC}{двести} +\newcommand*{\rNamenumberIIIC}{триста} +\newcommand*{\rNamenumberIVC}{четыреста} +\newcommand*{\rNamenumberVC}{пятьсот} +\newcommand*{\rNamenumberVIC}{шестьсот} +\newcommand*{\rNamenumberVIIC}{семьсот} +\newcommand*{\rNamenumberVIIIC}{восемьсот} +\newcommand*{\rNamenumberIXC}{девятьсот} +% +\chardef\m@mten=10 % shorthand for 10 +% Определение счетчиков +\newcounter{ism@mctr} % Единицы +\newcounter{xsm@mctr} % Десятки +\newcounter{csm@mctr} % Сотни +\newcounter{ksm@mctr} % Тысячи +\newcounter{xksm@mctr} % Десятки тысяч +\newcounter{cksm@mctr} % Сотни тысяч +\newcounter{msm@mctr} % Миллионы +\newcounter{xmsm@mctr} % Десятки миллионов +\newcounter{cmsm@mctr} % Сотни миллионов +\newcounter{bsm@mctr} % Миллиарды +\newcounter{workm@mctr} +% +% Установка счетчиков +\newcommand*{\numdigits}[1]{% + \setcounter{ism@mctr}{0}% + \setcounter{xsm@mctr}{0}% + \setcounter{csm@mctr}{0}% + \setcounter{ksm@mctr}{0}% + \setcounter{xksm@mctr}{0}% + \setcounter{cksm@mctr}{0}% + \setcounter{msm@mctr}{0}% + \setcounter{xmsm@mctr}{0}% + \setcounter{cmsm@mctr}{0}% + \setcounter{bsm@mctr}{0}% + \setcounter{workm@mctr}{#1}% + \minusnumberfalse + \ifnum \c@workm@mctr < \z@ % Отрицательное число? + \minusnumbertrue + \c@workm@mctr = -\c@workm@mctr + \fi + \ifnum \c@workm@mctr > \m@ne % единицы + \c@ism@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@ism@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Десятки + \c@xsm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@xsm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Сотни + \c@csm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@csm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Тысячи + \c@ksm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@ksm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Десятки тысяч + \c@xksm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@xksm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Сотни тысяч + \c@cksm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@cksm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Миллионы + \c@msm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@msm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Десятки миллионов + \c@xmsm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@xmsm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Сотни миллионов + \c@cmsm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@cmsm@mctr by -\c@workm@mctr + \divide \c@workm@mctr by \m@mten + \fi + \ifnum \c@workm@mctr > \z@ % Миллиарды + \c@bsm@mctr = \c@workm@mctr + \divide \c@workm@mctr by \m@mten + \multiply \c@workm@mctr by \m@mten + \advance \c@bsm@mctr by -\c@workm@mctr + \fi +} +% +% Формирование строки +\newcommand*{\form@tnumber}[1]{% + \numdigits{#1}% + \ifminusnumber -\fi + \priornumfalse + \ifpriornum % Миллиарды (max-2) + \thebsm@mctr + \else + \ifnum \c@bsm@mctr > \z@ + \priornumtrue + \thebsm@mctr + \fi + \fi + \ifpriornum % Сотни миллионов + \thecmsm@mctr + \else + \ifnum \c@cmsm@mctr > \z@ + \priornumtrue + \thecmsm@mctr + \fi + \fi + \ifpriornum % Десятки миллионов + \thexmsm@mctr + \else + \ifnum \c@xmsm@mctr > \z@ + \priornumtrue + \thexmsm@mctr + \fi + \fi + \ifpriornum % Миллионы + \themsm@mctr + \else + \ifnum \c@msm@mctr > \z@ + \priornumtrue + \themsm@mctr + \fi + \fi + \ifpriornum % Сотни тысяч + \thecksm@mctr + \else + \ifnum \c@cksm@mctr > \z@ + \priornumtrue + \thecksm@mctr + \fi + \fi + \ifpriornum % Десятки тысяч + \thexksm@mctr + \else + \ifnum \c@xksm@mctr > \z@ + \priornumtrue + \thexksm@mctr + \fi + \fi + \ifpriornum % Тысячи + \theksm@mctr + \else + \ifnum \c@ksm@mctr > \z@ + \priornumtrue + \theksm@mctr + \fi + \fi + \ifpriornum % Сотни + \thecsm@mctr + \else + \ifnum \c@csm@mctr > \z@ + \priornumtrue + \thecsm@mctr + \fi + \fi + \ifpriornum % Десятки + \thexsm@mctr + \else + \ifnum \c@xsm@mctr > \z@ + \priornumtrue + \thexsm@mctr + \fi + \fi + \theism@mctr % Единицы +} +% +\newcommand*{\unitnumbername}[2]{% + \ifcase #1% + {\rNamenumberO}% + \or{\ifnum #2=\@ne одна\else\rNamenumberI\fi}% Для тысяч + \or{\ifnum #2=\@ne две\else\rNamenumberII\fi}% Для тысяч + \or{\rNamenumberIII}% + \or{\rNamenumberIV}% + \or{\rNamenumberV}% + \or{\rNamenumberVI}% + \or{\rNamenumberVII}% + \or{\rNamenumberVIII}% + \or{\rNamenumberIX}% + \fi +} +% +\newcommand*{\teennumbername}[1]{% + \ifcase #1 + \rNamenumberX% + \or\rNamenumberXI% + \or\rNamenumberXII% + \or\rNamenumberXIII% + \or\rNamenumberXIV% + \or\rNamenumberXV% + \or\rNamenumberXVI% + \or\rNamenumberXVII% + \or\rNamenumberXVIII% + \or\rNamenumberXIX% + \fi +}% +% +\newcommand*{\tensnumbername}[3]{% + \ifnum #1=\@ne% + \teennumbername{#2}% + \else% + \ifcase #1 + \or + \or\rNamenumberIID% + \or\rNamenumberIIID% + \or\rNamenumberIVD% + \or\rNamenumberVD% + \or\rNamenumberVID% + \or\rNamenumberVIID% + \or\rNamenumberVIIID% + \or\rNamenumberIXD% + \fi + \ifnum #2 > \z@% + \space\unitnumbername{#2}{#3}% + \fi + \fi +}% +% +\newcommand*{\centnumbername}[1]{% + \ifnum #1 > \z@ + \ifcase #1 + \or\rNamenumberC% + \or\rNamenumberIIC% + \or\rNamenumberIIIC% + \or\rNamenumberIVC% + \or\rNamenumberVC% + \or\rNamenumberVIC% + \or\rNamenumberVIIC% + \or\rNamenumberVIIIC% + \or\rNamenumberIXC% + \fi + \fi +}% +%% +%% Подготовка строки +\newcommand*{\n@me@number}[1]{% + \numdigits{#1}% + \ifminusnumber\minusname\fi + \priornumfalse + %% Миллиарды + \ifnum \c@bsm@mctr > \z@ + \unitnumbername{\thebsm@mctr}{0} миллиард% + \ifnum\c@bsm@mctr=1% + \else\ifnum\c@bsm@mctr=2 а% + \else\ifnum\c@bsm@mctr=3 а% + \else\ifnum\c@bsm@mctr=4 а% + \else ов% + \fi\fi\fi\fi + \priornumtrue + \fi + %% Сотни миллионов + \ifnum \c@cmsm@mctr > \z@ + \ifpriornum\protect\space\fi + \centnumbername{\thecmsm@mctr}% + \ifnum\c@msm@mctr=0% + \ifnum\c@xmsm@mctr=0% + \protect\space миллионов\fi\fi + \priornumtrue + \fi + %% Десятки и единицы миллионов + \ifnum \c@xmsm@mctr > \z@ + \ifpriornum\protect\space\fi + % + \tensnumbername{\thexmsm@mctr}{\themsm@mctr}{0} миллион% + \ifnum\c@xmsm@mctr=1 ов% + \else\ifnum\c@msm@mctr=1% + \else\ifnum\c@msm@mctr=2 а% + \else\ifnum\c@msm@mctr=3 а% + \else\ifnum\c@msm@mctr=4 а% + \else ов% + \fi\fi\fi\fi\fi + \priornumtrue + \else + \ifnum \c@msm@mctr > \z@ + \ifpriornum\protect\space\fi + % + \unitnumbername{\themsm@mctr}{0} миллион% + \ifnum\c@msm@mctr=1% + \else\ifnum\c@msm@mctr=2 а% + \else\ifnum\c@msm@mctr=3 а% + \else\ifnum\c@msm@mctr=4 а% + \else ов% + \fi\fi\fi\fi + \priornumtrue + \fi + \fi + %% Сотни тысяч + \ifnum \c@cksm@mctr > \z@% + \ifpriornum\protect\space\fi + \centnumbername{\thecksm@mctr}% + \ifnum\c@ksm@mctr=0% + \ifnum\c@xksm@mctr=0 + \protect\space тысяч% + \fi\fi + \priornumtrue + \fi + %% Десятки и единицы тысяч + \ifnum \c@xksm@mctr > \z@% + % + \ifpriornum\protect\space\fi + \tensnumbername{\thexksm@mctr}{\theksm@mctr}{1} тысяч% + \priornumtrue + \else + \ifnum \c@ksm@mctr > \z@ + \ifpriornum\protect\space\fi% + % + \unitnumbername{\theksm@mctr}{1} тысяч% + \priornumtrue + \fi\fi + \ifnum\c@xksm@mctr=1\else% + \ifnum\c@ksm@mctr=1 а% + \else\ifnum\c@ksm@mctr=2 и% + \else\ifnum\c@ksm@mctr=3 и% + \else\ifnum\c@ksm@mctr=4 и% + \else\fi\fi\fi\fi\fi + %% Сотни + \ifnum \c@csm@mctr > \z@% + \ifpriornum\protect\space\fi + \centnumbername{\thecsm@mctr}% + \priornumtrue + \fi + %% Десятки/единицы + \ifnum \c@xsm@mctr > \z@% + \ifpriornum\protect\space\fi + % + \tensnumbername{\thexsm@mctr}{\theism@mctr}{0}% + \else + \ifnum \c@ism@mctr > \z@ + \ifpriornum\protect\space\fi% + % + \unitnumbername{\theism@mctr}{0}% + \else + \ifpriornum\else\unitnumbername{\theism@mctr}{0}\fi + \fi + \fi +}% +% +% Warning! +% max number to convert - 2'147'483'647 +% +\newcommand*{\numnameru}[1]{% + \n@me@number{#1}% +} +%% End of file `numnameru.sty'. +\endinput |