share
TeX - LaTeXTypesetting Babylonian numerals?
[+25] [2] Juan A. Navarro
[2011-08-17 12:42:03]
[ fonts symbols ]
[ https://tex.stackexchange.com/questions/25939/typesetting-babylonian-numerals ]

This question led to a new package:
babyloniannum [1]

I would like to typeset Babylonian numerals as shown e.g. on Wikipedia [2]. 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?

examples of Babylonian numerals

(1) A quick search on Google found: This - Seamus
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
(1) Two more links from a Google for "CTAN Cuneiform": ugarite and piska - Seamus
My laptop is very slow compiling LaTeX, but extremely slow compiling XeTeX, so for me, the latter is not an option. However, I managed to do two ugly hacks that are good enough for my purposes: $\stackon[-3pt]{$\text{l}$}{$\text{v}$}$ % Babylonian one; AND %$\big\langle \!\!\scriptstyle {\text{|}}$ % Babylonian ten - Henke - Нава́льный П с м
[+23] [2011-08-17 13:32:06] raphink [ACCEPTED]

There is a paleo-babylonian font on this page [1]. 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}{%
%\n\quad\babynum{\n}\\
%}

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

\end{document}

babylonian with adjusted kerning

Edit: There is now a package on CTAN [2], 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}{%
\n\quad\babyloniannum{\n}\\
}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {21,...,40}{%
\n\quad\babyloniannum{\n}\\
}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\noindent\foreach \n in {41,...,59}{%
\n\quad\babyloniannum{\n}\\
}
\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).

[1] http://www.hethport.uni-wuerzburg.de/cuneifont/
[2] http://mirror.ctan.org/macros/xetex/latex/babyloniannum

Note that there is a \ifcase<number> <zero>\or <one>\or <two>\or ...\else <else> \fi in TeX. - Martin Scharrer
Thanks @Martin. I updated my answer accordingly. That said, I think this should work with a modulo at some point. - raphink
I would also put the \ifnum into the \else clause of \ifcase. - Martin Scharrer
Also, please mention that you need to use XeLaTeX for this solution. - Martin Scharrer
Ok, done. How could I actually calculate a modulo? I know mod() in tikz, but can I do that outside of tikz? - raphink
@Raphink check out how something like numname deals with bigger numbers... - Seamus
You can make an integer devision and then subtract the result from the original value to get the modulo. - Martin Scharrer
@Seamus: interesting. Maybe it's just me, but I find it scary how simple things in most computer languages look freaky in TeX. - raphink
@Martin: I find that it's very hard to find doc on how to perform operations in TeX, since most results explain how to typeset the operations rather than perform them. - raphink
@Seamus: Actually, I'm going to make use of the \numdigits function from numname since it does the job already. - raphink
@Raphink You might also consider using the much more sophisticated fmtcount package... - Seamus
The font doc turns out to be wrong, 9 is mapped at 1240E, quite logically... - raphink
@Seamus: well \numdigits returns what I need :-) - raphink
Awesome work! Thanks Raphink and all others who helped building this great answer! - Juan A. Navarro
(3) @Juan: the package is already on CTAN: mirror.ctan.org/macros/xetex/latex/babyloniannum - raphink
This is why I love this site. Don't forget to add this package to meta.tex.stackexchange.com/questions/1181/… ;-) - doncherry
It would be great if the package supported bold font... - Jay
@Jay PR welcome github.com/raphink/babylonian - raphink
1
[+6] [2011-08-17 13:02:03] Martin Scharrer

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 [1].

[1] https://tex.stackexchange.com/questions/22487/create-a-symbol-font-from-svg-symbols

2