The babyloniannum package
Raphaël Pinson
raphink@gmail.com
0.5 from 2011/08/19
𒁹
Introduction
This package was created as an answer to a question1 about typesetting
Babylo-nian numerals asked on http://tex.stackexchange.com.
This package allows to typeset Babylonian numerals using X E TEX or LuaTEX. It makes use of the Santakku Paleo-Babylonian TrueType font which can be down-loaded at http://www.hethport.uni-wuerzburg.de/cuneifont/.
𒈫
Usage
\babylonianfont
Set the font used. Currently, only the Santakku font has been tested. Let me know if you get the package to work with other fonts.
Example usage: \babyloninanfont{Santakku}
\babyloniannum
This is the main macro of this package. It takes a number between 1 and 59 as argument and typesets it with Babylonian numerals.
Example usage:
\babyloninannum{424000} is 𒁹 𒐐𒐌 𒐏𒐋 𒐏 (1,57,46,40 in base 60) \babyloninannum{21609} is 𒐋 𒐎 (6,0,9 in base 60)
\babylonian
Like \arabic or \roman, this macro takes a counter name as argument and returns its Babylonian representation.
For example, this documentation is typeset with:
\renewcommand{\thesection}{\babylonian{section}} \unicodedisp
𒐈
Table of characters
𒃻
Known issues
𒃻
. 𒁹
Glyph for 20
The glyph for number 20 was not found in the Santakku font. Therefore, it has been replaced by the combination of two 10 glyphs, with a kerning adjustment.
𒃻
. 𒈫
Glyph for 0
The Babylonian system has no glyph for 0, which is represented by a large space. In this package, 0 is implemented as a 0.5em kerning space.
𒃻
. 𒐈
Multiples of 60
The Babylonian numeral system is a sexagesimal system (a positional base 60 system), which does not feature a glyph for 0. Therefore, a number such as 𒌋𒌋𒐈 can stand for 23, 23 × 60 or 23 × 60 × 60 or even 23/60. Only the context allows to decide which number is represented.
𒐊
Implementation
1\ProvidesPackage{babyloniannum} 2\RequirePackage{fontspec} 3\RequirePackage{xunicode} 4\RequirePackage{numname} \babylonianfont 5\newcommand{\babylonianfont}{Santakku} \unicodedisp 6\newcommand{\unicodedisp}[1]{\char"#1} \babylonian 7\newcommand{\babylonian}[1]{% 8 \protect\babyloniannum{\arabic{#1}}} \babylonianglyph 9\newcommand{\babylonianglyph}[1]{% 10\ifnum #1 > \z@ % glyph is not zero 11 \chardef\m@mten=10 % cuts by units of 10 12 \numdigits{#1} % parse number13 \ifcase\c@xsm@mctr % 14 \relax %
15 \or
20 \unicodedisp{1230D} %30 21 \or 22 \unicodedisp{1240F} %40 23 \or 24 \unicodedisp{12410} %50 25 \fi 26 \ifnum \c@ism@mctr > \z@ % 27 \ifnum \c@xsm@mctr > \z@ % 28 \kern-0.5em{} % make glyphs closer 29 \fi % 30 \fi % 31 \ifcase\c@ism@mctr % 32 \or 33 \unicodedisp{12079} %1 34 \or 35 \unicodedisp{1222B} %2 36 \or 37 \unicodedisp{12408} %3 38 \or 39 \unicodedisp{120FB} %4 40 \or 41 \unicodedisp{1240A} %5 42 \or 43 \unicodedisp{1240B} %6 44 \or 45 \unicodedisp{1240C} %7 46 \or 47 \unicodedisp{1240D} %8 48 \or 49 \unicodedisp{1240E} %9 50 \fi 51 \addtocounter{baby@glyphs}{1}% 52\else 53 \ifnum\c@baby@glyphs > \z@ % 54\kern0.5em{}% empty space for zero 55 \fi 56\fi 57} \babylonian@setcounters 58\newcounter{baby@ism@mctr} % "units" 59\newcounter{baby@xsm@mctr} % "tens" 60\newcounter{baby@csm@mctr} % "hundreds" 61\newcounter{baby@ksm@mctr} % "thousands" 62\newcounter{baby@xksm@mctr} % "ten thousands" 63\newcounter{baby@cksm@mctr} % "hundred thousands" 64\newcounter{baby@msm@mctr} % "millions"
68\newcommand{\babylonian@setcounters}{% 69 \setcounter{baby@ism@mctr}{\c@ism@mctr}% 70 \setcounter{baby@xsm@mctr}{\c@xsm@mctr}% 71 \setcounter{baby@csm@mctr}{\c@csm@mctr}% 72 \setcounter{baby@ksm@mctr}{\c@ksm@mctr}% 73 \setcounter{baby@xksm@mctr}{\c@xksm@mctr}% 74 \setcounter{baby@cksm@mctr}{\c@cksm@mctr}% 75 \setcounter{baby@msm@mctr}{\c@msm@mctr}% 76 \setcounter{baby@xmsm@mctr}{\c@xmsm@mctr}% 77 \setcounter{baby@cmsm@mctr}{\c@cmsm@mctr}% 78 \setcounter{baby@bsm@mctr}{\c@bsm@mctr}% 79} \babyloniannum 80\newcounter{baby@glyphs}% 81\newcommand{\babyloniannum}[1]{%
82 \chardef\m@mten=60 % Cut by units of 60 83 \numdigits{#1} % Parse number