# Typesetting Babylonian numerals?

This question led to a new package:
babyloniannum

I would like to typeset Babylonian numerals as shown e.g. on Wikipedia. Ideally I would like a command where I can type something like $\babylonian{42}$ and get it to produce the appropriate symbol, but I will be also happy if there is a font or something where I can get the symbols and then stack them together myself.

Is there anything for this already implemented?

-
A quick search on Google found: This – Seamus Aug 17 '11 at 12:47
There's a section of the symbols guide that lists some ancient scripts pacakges. No Babylonian numeral package, but some of the Linear A symbols get close... – Seamus Aug 17 '11 at 12:50
Two more links from a Google for "CTAN Cuneiform": ugarite and piska – Seamus Aug 17 '11 at 12:52

There is a paleo-babylonian font on this page. Using fontspec with XeTeX or LuaTex and things like \char"1240D, you could easily typeset what you need.

Here is a quick example for XeTeX.

Note: It turns out that the font doc is wrong (Ah! If they used TeX to generate it...) and 9 is actually mapped at 1240E, quite logically. Also, 20 seems to be missing while 30 is mapped several times for some reason, so I'm doing 20 with 2 "10" glyphs and a bit of kerning. I'm also adjust kerning between tens and units.

\documentclass[paper=a4]{minimal}

\usepackage{fontspec}
\usepackage{xunicode}

\usepackage{pgffor}
\usepackage{numname}

\newcommand{\babydisp}[1]{%
\fontspec{Santakku}{\char"#1}}

\makeatletter
\newcommand{\babynum}[1]{%
\numdigits{#1}%
\ifcase\c@xsm@mctr
\or
\babydisp{1230B} %10
\or
\babydisp{1230B}\kern-1.5pt{}\babydisp{1230B} %20 -- unknown?
\or
\babydisp{1230D} %30
\or
\babydisp{1240F} %40
\or
\babydisp{12410} %50
\fi
\kern-4pt{}%
\ifcase\c@ism@mctr
\or
\babydisp{12079} %1
\or
\babydisp{1222B} %2
\or
\babydisp{12408} %3
\or
\babydisp{120FB} %4
\or
\babydisp{1240A} %5
\or
\babydisp{1240B} %6
\or
\babydisp{1240C} %7
\or
\babydisp{1240D} %8
\or
\babydisp{1240E} %9
\fi
}
\makeatother

\begin{document}

%\noindent\foreach \n in {1,...,59}{%
%}

\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {1,...,20}{%
}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {21,...,40}{%
}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {41,...,59}{%
}
\end{minipage} \hfill

\end{document}


Edit: There is now a package on CTAN, so you can use it as follows:

\documentclass[paper=a4]{minimal}

\usepackage{pgffor}
\usepackage{babyloniannum}

\begin{document}

\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {1,...,20}{%
}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {21,...,40}{%
}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {41,...,59}{%
}
\end{minipage} \hfill

\end{document}


Edit: Version 0.4 of the package allows to typeset numbers beyond 59 (up to 60^9 = 1.0077696 × 10^16 in theory, although I think TeX will give up before that).

-
Note that there is a \ifcase<number> <zero>\or <one>\or <two>\or ...\else <else> \fi in TeX. – Martin Scharrer Aug 17 '11 at 14:14
Thanks @Martin. I updated my answer accordingly. That said, I think this should work with a modulo at some point. – ℝaphink Aug 17 '11 at 14:21
I would also put the \ifnum into the \else clause of \ifcase. – Martin Scharrer Aug 17 '11 at 14:24
Also, please mention that you need to use XeLaTeX for this solution. – Martin Scharrer Aug 17 '11 at 14:26
@Juan: the package is already on CTAN: mirror.ctan.org/macros/xetex/latex/babyloniannum – ℝaphink Aug 18 '11 at 9:06

Wikipedia also has the two needed symbols as SVG vector graphics:
http://en.wikipedia.org/wiki/File:Babylonian_1.svg
http://en.wikipedia.org/wiki/File:Babylonian_10.svg

You can turn them rather easily to PDF using e.g. inkscape --export-pdf=<pdf> <svg>. Then position them in the shown way for all numbers from 1-59. For larger numbers you would need to add some loop.

It is also possible to make your own font as shown in Create a symbol font from SVG symbols.

-