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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
% \iffalse meta-comment
%
% This file is part 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>.
%
% \fi
%% \CheckSum{146}
%\iffalse
%
%% This is file `athnum.dtx'
%% (c) 1997-2007 Apostolos Syropoulos.
%% Changes in version 2 © 2022, 2023 Günter Milde
%% All rights reserved.
%\fi
%
% \iffalse
% \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=black}
% auxiliary macro to keep the documentation independent of Greek text fonts
\def\PiIt#1{{%
\newdimen\boxW \newdimen\boxH
\settowidth{\boxW}{#1}%
\settoheight{\boxH}{#1}%
\addtolength{\boxW}{0.8pt}
\vbox{%
\hrule width\boxW\hbox{%
\vrule height\boxH\mbox{#1}%
\vrule height\boxH}}\kern.5pt}}
\GetFileInfo{athnum.drv}
\begin{document}
\DocInput{athnum.dtx}
\end{document}
%</driver>
% \end{macrocode}
% \fi
%%\title{Athenian (Attic) Numerals}
% \author{Apostolos Syropoulos}
% \date{2003/08/24}
%\maketitle
%
%\MakeShortVerb{\|}
%
%\section{Introduction}
%
% This \LaTeX\ package implements the macro
% \DescribeMacro{\athnum}
% |\athnum|.
% The macro transforms an Arabic numeral, i.e., the kind of numerals
% we all use (e.g., 1, 5, 789 etc), to the corresponding
% \href{https://en.wikipedia.org/wiki/Attic_numerals}{\emph{Athenian} numeral}.
% It can also be used to display counters.
% The package requires a Greek text font and
% the |greek-fontenc| package.\footnote{%
% Up to version 1.1, `athnum' required that Babel was loaded with the
% |greek| option. Version 2.0 sets up Greek font support autonomously.}
%
%\section{The Numbering System}
%
% The athenian numbering system, like the roman one, employs
% letters to denote important numbers. Multiple occurrence of a letter denote
% a multiple of the ``important'' number, e.g., the letter I denotes 1, so
% III denotes 3. Here are the basic digits used in the Athenian numbering
% system:
% \begin{itemize}
% \item I denotes the number one (1)
% \item $\Pi$ denotes the number five (5)
% \item $\Delta$ denotes the number ten (10)
% \item H denotes the number one hundred (100)
% \item X denotes the number one thousand (1000)
% \item M denotes the number ten thousands (10000)
%\end{itemize}
% Moreover, the letters $\Delta$, H, X, and M under the letter $\Pi$,
% denote five times their original value, e.g., the symbol
% \PiIt{X}, denotes the number 5000, and the symbol
% \PiIt{$\Delta$}, denotes the number 50. It must be noted that
% the numbering system does not provide negative numerals or a symbol for
% zero.
%
% The Athenian numbering system is described, among others, in an article in
% Encyclopedia $\Delta o\mu\acute{\eta}$, Vol. 2, page 280, 7th edition,
% Athens, October 2, 1975.
%
% \section{The Code}
%
% Before we do anything further, we have to identify the package.
% \StopEventually
%
% \begin{macrocode}
%<*package>
\NeedsTeXFormat{LaTeX2e}[1996/01/01]
\ProvidesPackage{athnum}[2023/03/17 v2.0.1 Athenian numerals]
% \end{macrocode}
%
% \subsection{Font Setup}
%
% Typesetting Greek texts requires a font with Greek characters:
%
% For 8-bit LaTeX, this package uses fonts with the LGR font encoding.
% With the XeTeX or LuaTeX engines and Unicode fonts, the user must ensure
% that the selected font contains the required glyphs
% (only few fonts support the "GREEK ACROPHONIC ..." characters).
% LGR-encoded fonts can also be used alongside Unicode fonts with XeTeX/LuaTeX
% to enable the input of Greek letters via the Latin transliteration provided by
% this font encoding.
%
% \DescribeMacro\greekfontencoding
% We test for available font encodings and set |\greekfontencoding|
% and the internal macro |\athnum@greek@fontencdef| with the name of the
% font definition file that defines the required Greek LICR macros.
% The default is LGR for 8-bit TeX engines and TU for Xe/LuaTeX.
% \begin{macrocode}
\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
% \end{macrocode}
% Ensure that the Greek LICR macros are available:
% \begin{macrocode}
\@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.}
{I can't find the \athnum@greek@fontencdef .def file
for the Greek fonts (encoding \greekfontencoding).}
\@@end
}
}
% \end{macrocode}
% \begin{macro}{\ensuregreek}
% The TextCommand |\ensuregreek| sets it argument in |\greekfontencoding|
% if the current font encoding does not provide a (typically empty) local
% variant.
% \begin{macrocode}
\ProvideTextCommandDefault{\ensuregreek}[1]{%
\leavevmode{\fontencoding{\greekfontencoding}\selectfont #1}}
% \end{macrocode}
% \end{macro}
%
% \subsection{Transform Arabic Numeral to Athenian Numeral}
%
%\begin{macro}{\@@athnum}
% Now, we turn our attention to the definition of the macro
% |\@@athnum|. This macro uses one integer variable (or counter in
% \TeX's jargon.)
% \begin{macrocode}
\newcount\@ath@num
% \end{macrocode}
% The macro |\@@athnum| is also defined as a robust command.
% \begin{macrocode}
\DeclareRobustCommand*{\@@athnum}[1]{%
% \end{macrocode}
% After assigning to variable |\@ath@num| the value of the macro's argument,
%we make sure that the argument is in the expected range, i.e., it is greater
% than zero, and less or equal to $249999$. In case it isn't, we simply
% produce a |\space|, warn the user about it and quit. Although, the
% |\athnum| macro is capable to produce an Athenian numeral for even greater
% intergers, the following argument by Claudio Beccari convised me to place
% this above upper limit:
% \begin{quote}
% According to psychological perception studies (that ancient Athenians
% and Romans perfectly knew without needing to study Freud and Jung)
% living beings (which includes at least all vertebrates, not only
% humans) can perceive up to four randomly set objects of the same kind
% without the need of counting, the latter activity being a specific
% acquired ability of human kind; the biquinary numbering notation
% used by the Athenians and the Romans exploits this natural
% characteristic of human beings.
% \end{quote}
% \begin{macrocode}
\@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
% \end{macrocode}
% Having done all the necessary checks, we are now ready to do the actual
% computation. If the number is greater than $49999$, then it certainly
% has at least one \PiIt{M} ``digit''. We find all such digits by continuously
% subtracting $50000$ from |\@ath@num|, until |\@ath@num| becomes less than
% $50000$.
% \begin{macrocode}
\@whilenum\@ath@num>49999\do{%
\textpentemuria\advance\@ath@num-50000}%
% \end{macrocode}
% We now check for tens of thousands.
% \begin{macrocode}
\@whilenum\@ath@num>9999\do{%
\textMu\advance\@ath@num-\@M}%
% \end{macrocode}
% Since a number can have only one \PiIt{X} ``digit'' (equivalent to 5000), it
% is easy to check it out and produce the corresponding numeral in case it does
% have one.
% \begin{macrocode}
\ifnum\@ath@num>4999%
\textpenteqilioi\advance\@ath@num-5000%
\fi\relax
% \end{macrocode}
% Next, we check for thousands, the same way we checked for tens of thousands.
% \begin{macrocode}
\@whilenum\@ath@num>999\do{%
\textChi\advance\@ath@num-\@m}%
% \end{macrocode}
% Like the five thousands, a numeral can have at most one \PiIt{H} ``digit''
% (equivalent to 500).
% \begin{macrocode}
\ifnum\@ath@num>499%
\textpentehekaton\advance\@ath@num-500%
\fi\relax
% \end{macrocode}
% It is time to check hundreds, which follow the same pattern as thousands
% \begin{macrocode}
\@whilenum\@ath@num>99\do{%
\textEta\advance\@ath@num-100}%
% \end{macrocode}
% A numeral can have only one \PiIt{$\Delta$} ``digit'' (equivalent to 50).
% \begin{macrocode}
\ifnum\@ath@num>49%
\textpentedeka\advance\@ath@num-50%
\fi\relax
% \end{macrocode}
% Let's check now decades.
% \begin{macrocode}
\@whilenum\@ath@num>9\do{%
\textDelta\advance\@ath@num by-10}%
% \end{macrocode}
% We check for five and, finally, for the digits 1, 2, 3, and 4.
% \begin{macrocode}
\@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}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@athnum}
% The command |\@athnum| has one argument, which
% is a counter. It calls the command |\@@athnum| to process the value of
% the counter.
% \begin{macrocode}
\def\@athnum#1{%
\expandafter\@@athnum\expandafter{\the#1}}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\athnum}
% The command |\athnum| is a wrapper that declares a new counter
% in a local scope, assigns to it the argument of the command
% and calls the macro |\@athnum|.
% This way the command can process correctly either a number or a counter.
% It also ensures that the argument is set with a Greek text font.
% \begin{macrocode}
\def\athnum#1{%
\textrm{\ensuregreek{%
\@ath@num#1\relax
\@athnum{\@ath@num}}%
}}
%</package>
% \end{macrocode}
%\end{macro}
%
% \section{Changes}
% \begin{description}
% \item [athnum-2.0 2022/12/08]
% Do not require Babel.
% Support Unicode fonts.
% Drop the backwards compatibility definitions
% for |\PiDelta|, |\PiEta|, |\PiChi|, and |\PiMu|.
% \item [athnum-2.0.1 2023/03/17]
% Fix behaviour in math mode.
% \end{description}
%
% \section*{Acknowledgment}
% I would like to thank Claudio Beccari for reading the documentation
% and for his very helpful suggestions. In addition, Antonis Tsolomitis
% spotted a bug in the first version, which is corrected in the present
% version.
% \section*{Dedication}
% I would like to dedicate this piece of work to my son
% \begin{center}Demetrios-Georgios.\end{center}
%
%
% \Finale
%
\endinput
|