summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/babel-contrib/greek/athnum.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-03-05 03:01:34 +0000
committerNorbert Preining <norbert@preining.info>2023-03-05 03:01:34 +0000
commita2d17a09f7ecd91acd8826216349bb14cc5602cd (patch)
treef5560fff94ed497200d93e8fa4a0c0f8f900e281 /macros/latex/contrib/babel-contrib/greek/athnum.dtx
parent7761a2c2ae5e392243a4e09aefe8c69a97a1d0f6 (diff)
CTAN sync 202303050301
Diffstat (limited to 'macros/latex/contrib/babel-contrib/greek/athnum.dtx')
-rw-r--r--macros/latex/contrib/babel-contrib/greek/athnum.dtx206
1 files changed, 114 insertions, 92 deletions
diff --git a/macros/latex/contrib/babel-contrib/greek/athnum.dtx b/macros/latex/contrib/babel-contrib/greek/athnum.dtx
index 3ea1f5325a..3c1f3f4636 100644
--- a/macros/latex/contrib/babel-contrib/greek/athnum.dtx
+++ b/macros/latex/contrib/babel-contrib/greek/athnum.dtx
@@ -1,11 +1,8 @@
% \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.
-% --------------------------------------
-%
+% 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.
@@ -13,33 +10,19 @@
% 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.
+%
+% The Current Maintainer of this work is Günter Milde <milde@users.sf.net>.
+%
% \fi
-%% \CheckSum{125}
+%% \CheckSum{150}
%\iffalse
%
%% This is file `athnum.dtx'
%% (c) 1997-2007 Apostolos Syropoulos.
+%% Changes in version 2.0 © 2022 Günter Milde
%% 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
@@ -62,26 +45,25 @@
%</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.}}
+%\title{Attic (or Athenian) Numerals}
% \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
+%
+% 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.
+% {\itshape Athenian} (or \emph{Attic} numeral. Athenian numerals were in
+% use mainly in ancient Athens. 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}
%
@@ -95,57 +77,92 @@
% \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 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
+% 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.
+% 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}
+% \section{The Code}
+%
+% \changes{athnum-2.0}{2022/12/08}{%
+% Do not require Babel to be loaded with the |greek| option.\\
+% Use LICR macros instead of the Latin transliteration for Greek letters
+% to fix working with Unicode fonts.\\
+% Drop the backwards compatibility definitions for PiDelta, PiEta,
+% PiChi, and PiMu.}
+%
% 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
- }}
+\ProvidesPackage{athnum}[2022/12/08\space v2.0]
+\typeout{Package: `athnum' v2.0\space <2022/12/08> (A. Syropoulos)}
% \end{macrocode}
+% \section{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.
%
-% 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.
+% \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}
-\DeclareTextCommand{\PiDelta}{LGR}{\char"02\relax}
-\DeclareTextCommand{\PiEta}{LGR}{\char"03\relax}
-\DeclareTextCommand{\PiChi}{LGR}{\char"04\relax}
-\DeclareTextCommand{\PiMu}{LGR}{\char"05\relax}
+\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}
-%\begin{macro}{\@@athnum}
-% Now, we turn our attention to the definition of the macro
-% |\@@athnum|. This macro uses one integer variable (or counter in
+% 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\\
+ or use XeTeX/LuaTeX.}
+ {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}
+%
+%\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
@@ -154,18 +171,18 @@
% \begin{macrocode}
\DeclareRobustCommand*{\@@athnum}[1]{%
% \end{macrocode}
-% After assigning to variable |\@ath@num| the value of the macro's argument,
+% 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
+% 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}
+% \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
+% 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
@@ -187,61 +204,64 @@
% 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$.
+% $50000$.
% \begin{macrocode}
\@whilenum\@ath@num>49999\do{%
- \PiMu\advance\@ath@num-50000}%
+ \textpentemuria\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}%
+ \textMu\advance\@ath@num-\@M}%
% \end{macrocode}
-% Since a number can have only one \PiIt{X} ``digit'' (equivalent to 5000), it
+% 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%
+ \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{%
- Q\advance\@ath@num-\@m}%
+ \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%
- \PiEta\advance\@ath@num-500%
+ \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{%
- H\advance\@ath@num-100}%
+ \textEta\advance\@ath@num-100}%
% \end{macrocode}
% A numeral can have only one \PiIt{$\Delta$} ``digit'' (equivalent to 50).
-% \begin{macrocode}
+% \begin{macrocode}
\ifnum\@ath@num>49%
- \PiDelta\advance\@ath@num-50%
+ \textpentedeka\advance\@ath@num-50%
\fi\relax
% \end{macrocode}
% Let's check now decades.
-% \begin{macrocode}
+% \begin{macrocode}
\@whilenum\@ath@num>9\do{%
- D\advance\@ath@num by-10}%
+ \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{%
- P\advance\@ath@num-5}%
- \ifcase\@ath@num\or I\or II\or III\or IIII\fi%
+ \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
@@ -255,11 +275,13 @@
% 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.
+% either a number or a counter.
% \begin{macrocode}
\def\athnum#1{%
- \@ath@num#1\relax
- \@athnum{\@ath@num}}
+ \ensuregreek{%
+ \@ath@num#1\relax
+ \@athnum{\@ath@num}}%
+ }
%</package>
% \end{macrocode}
%\end{macro}
@@ -268,9 +290,9 @@
% 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.
+% version.
% \section*{Dedication}
-% I would like to dedicate this piece of work to my son
+% I would like to dedicate this piece of work to my son
% \begin{center}Demetrios-Georgios.\end{center}
% \Finale
%