summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/babel-greek/athnum.sty
blob: bbd21dae13c73360a809acae4fba6c5a8dda3cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
%%
%% This is file `athnum.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% athnum.dtx  (with options: `package')
%% This is a generated file.
%% 
%% Copyright 1989-2008 Apostolos Syropoulos, Johannes L. Braams, Günter Milde,
%% and the authors listed elsewhere in this file. All rights reserved.
%% 
%% This file was generated from file(s) of the babel-greek package.
%% ----------------------------------------------------------------
%% 
%% It 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 2003/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainer of this work is Günter Milde <milde@users.sf.net>.
%% 
%% Babel-greek is a contributed package providing support for the Greek
%% language and script via the Babel system (https://ctan.org/pkg/babel).
%% 
%% The list of derived (unpacked) files belonging to this work
%% and covered by LPPL is defined by the unpacking script (babel-greek.ins)
%% which is part of the package.
%% \CheckSum{150}
%% This is file `athnum.dtx'
%% (c) 1997-2007 Apostolos Syropoulos.
%% Changes in version 2.0 © 2022 Günter Milde
%% All rights reserved.
\NeedsTeXFormat{LaTeX2e}[1996/01/01]
\ProvidesPackage{athnum}[2022/12/08\space v2.0]
\typeout{Package: `athnum' v2.0\space <2022/12/08> (A. Syropoulos)}
\ifdefined \UnicodeEncodingName % set by LaTeX for XeTeX/LuaTeX
  \providecommand*{\greekfontencoding}{\UnicodeEncodingName}
  \providecommand*{\athnum@greek@fontencdef}{tuenc-greek}
\else
  \providecommand*{\greekfontencoding}{LGR}
  \providecommand*{\athnum@greek@fontencdef}{lgrenc}
\fi
\@ifl@aded{def}{\athnum@greek@fontencdef}{}
{% else
  \InputIfFileExists{\athnum@greek@fontencdef .def}{}{% else
    \PackageError{athnum}{Font support for the Greek script missing.\\
               can't typeset Greek symbols.\\
               Install the "greek-fontenc" package\\
               or use XeTeX/LuaTeX.}
              {I can't find the \athnum@greek@fontencdef .def file
               for the Greek fonts (encoding \greekfontencoding)}
    \@@end
  }
}
\ProvideTextCommandDefault{\ensuregreek}[1]{%
  \leavevmode{\fontencoding{\greekfontencoding}\selectfont #1}}
\newcount\@ath@num
\DeclareRobustCommand*{\@@athnum}[1]{%
        \@ath@num#1\relax
        \ifnum\@ath@num<\@ne%
          \space%
          \PackageWarning{athnum}{%
          Illegal value (\the\@ath@num) for athenian numeral}%
        \else\ifnum\@ath@num>249999%
          \space%
          \PackageWarning{athnum}{%
          Illegal value (\the\@ath@num) for athenian numeral}%
        \else
            \@whilenum\@ath@num>49999\do{%
               \textpentemuria\advance\@ath@num-50000}%
            \@whilenum\@ath@num>9999\do{%
               \textMu\advance\@ath@num-\@M}%
            \ifnum\@ath@num>4999%
               \textpenteqilioi\advance\@ath@num-5000%
            \fi\relax
            \@whilenum\@ath@num>999\do{%
               \textChi\advance\@ath@num-\@m}%
            \ifnum\@ath@num>499%
               \textpentehekaton\advance\@ath@num-500%
            \fi\relax
            \@whilenum\@ath@num>99\do{%
               \textEta\advance\@ath@num-100}%
            \ifnum\@ath@num>49%
               \textpentedeka\advance\@ath@num-50%
            \fi\relax
            \@whilenum\@ath@num>9\do{%
               \textDelta\advance\@ath@num by-10}%
            \@whilenum\@ath@num>4\do{%
               \textPi\advance\@ath@num-5}%
            \ifcase\@ath@num \or \textIota
       \or \textIota\textIota
       \or \textIota\textIota\textIota
       \or \textIota\textIota\textIota\textIota\fi%
   \fi\fi}
\def\@athnum#1{%
     \expandafter\@@athnum\expandafter{\the#1}}
\def\athnum#1{%
     \ensuregreek{%
       \@ath@num#1\relax
       \@athnum{\@ath@num}}%
     }
\endinput
%%
%% End of file `athnum.sty'.