summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/greek/athnum.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/babel-contrib/greek/athnum.dtx')
-rw-r--r--macros/latex/contrib/babel-contrib/greek/athnum.dtx277
1 files changed, 277 insertions, 0 deletions
diff --git a/macros/latex/contrib/babel-contrib/greek/athnum.dtx b/macros/latex/contrib/babel-contrib/greek/athnum.dtx
new file mode 100644
index 0000000000..3ea1f5325a
--- /dev/null
+++ b/macros/latex/contrib/babel-contrib/greek/athnum.dtx
@@ -0,0 +1,277 @@
+% \iffalse meta-comment
+%
+% Copyright 1989-2008 Johannes L. Braams and any individual authors
+% listed elsewhere in this file. All rights reserved.
+%
+% This file is part of the Babel system.
+% --------------------------------------
+%
+% 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 Johannes Braams.
+%
+% The list of all files belonging to the Babel system is
+% given in the file `manifest.bbl. See also `legal.bbl' for additional
+% information.
+%
+% The list of derived (unpacked) files belonging to the distribution
+% and covered by LPPL is defined by the unpacking scripts (with
+% extension .ins) which are part of the distribution.
+% \fi
+%% \CheckSum{125}
+%\iffalse
+%
+%% This is file `athnum.dtx'
+%% (c) 1997-2007 Apostolos Syropoulos.
+%% All rights reserved.
+%
+% Please report errors or suggestions for improvement to
+%
+% Apostolos Syropoulos
+% 366, 28th October Str.
+% GR-671 00 Xanthi, GREECE
+% apostolo at platon.ee.duth.gr or apostolo at obelix.ee.duth.gr
+%
+%\fi
+%
+% \iffalse
+% \begin{macrocode}
+%<*driver>
+\documentclass{ltxdoc}
+\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 Numerals II\footnote{The documentation of this
+% package is essentially the same as that of the package `grnumalt'.
+% The `II' serves as a means to distinguish the two documents.}}
+% \author{Apostolos Syropoulos\\366, 28th October Str.\\
+% GR-671 00 Xanthi, HELLAS\\ Email:\texttt{apostolo@platon.ee.duth.gr}}
+% \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
+% {\itshape Athenian} numeral. Athenian numerals were in use only in
+% ancient Athens. The package can be used only in conjunction with the
+% |greek| option of the |babel| package.
+%
+%\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}[2003/08/24\space v1.1]
+\typeout{Package: `athnum' v1.1\space <2003/08/24> (A. Syropoulos)}
+% \end{macrocode}
+% Next we check to see if the |babel| package is loaded with at least
+% the |greek| option. In case it isn't, we opt to produce an error message.
+% \begin{macrocode}
+\@ifpackagewith{babel}{greek}{}{%
+ \@ifpackagewith{babel}{polutonikogreek}{}{%
+ \PackageError{athnum}{%
+ `greek' option of the `babel'\MessageBreak
+ package hasn't been loaded}{%
+ The commands provided by this package\MessageBreak
+ are specially designed for greek language\MessageBreak
+ typesetting with the `babel' package. Load\MessageBreak
+ it with at least the `greek' option.}\relax
+ }}
+% \end{macrocode}
+%
+% As it is mentioned in the introduction, the Athenian numerals employ
+% some special digits. These digits are included in the |cb| fonts of
+% Claudio Beccari, and so we must provide access commands.
+% \begin{macrocode}
+\DeclareTextCommand{\PiDelta}{LGR}{\char"02\relax}
+\DeclareTextCommand{\PiEta}{LGR}{\char"03\relax}
+\DeclareTextCommand{\PiChi}{LGR}{\char"04\relax}
+\DeclareTextCommand{\PiMu}{LGR}{\char"05\relax}
+% \end{macrocode}
+%\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{%
+ \PiMu\advance\@ath@num-50000}%
+% \end{macrocode}
+% We now check for tens of thousands.
+% \begin{macrocode}
+ \@whilenum\@ath@num>9999\do{%
+ M\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%
+ \PiChi\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{%
+ Q\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%
+ \PiEta\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{%
+ H\advance\@ath@num-100}%
+% \end{macrocode}
+% A numeral can have only one \PiIt{$\Delta$} ``digit'' (equivalent to 50).
+% \begin{macrocode}
+ \ifnum\@ath@num>49%
+ \PiDelta\advance\@ath@num-50%
+ \fi\relax
+% \end{macrocode}
+% Let's check now decades.
+% \begin{macrocode}
+ \@whilenum\@ath@num>9\do{%
+ D\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{%
+ P\advance\@ath@num-5}%
+ \ifcase\@ath@num\or I\or II\or III\or IIII\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.
+% \begin{macrocode}
+\def\athnum#1{%
+ \@ath@num#1\relax
+ \@athnum{\@ath@num}}
+%</package>
+% \end{macrocode}
+%\end{macro}
+%
+% \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