# Babylonian numerals with Texlive

I successfully used babylonian numerals with xelatex in Windows with Miktex, but I would like to do this now in Linux with Texlive. I installed texlive2018 portable full (but without docs and some languages). When I ran xelatex, the following error occurred:

! LaTeX Error: File babyloniannum.sty' not found.


Then, I put the babylonian-master folder which contains the babyloniannum.sty file in .../texlive/texmf-local/tex/latex/local/ (Is this the correct location?) and after running texhash, the next error was:

! Package fontspec Error: The font "Santakku" cannot be found.


I have the folder santakku with only these files:

Paleo-Babylonien.pdf
Santakku.ttf
SantakkuM.ttf


so, where should I put it? And how to tell xelatex to use it?

Note: I need to do without sudo password.

• And one more question: Why don't texlive-full comes with this font? – Rodolfo FR Feb 3 '19 at 16:30
• for the fonts your can try texmf-local/fonts/truetype/.... Perhaps you will to call the fonts by filename and not by fontname. For the pdf it depends. If is a docu, put it in texmf-local/doc/latex, if it is needed at runtime, it should be in texmf-local/tex/latex. – Ulrike Fischer Feb 3 '19 at 16:34
• Why do you expect texlive to contain a font which is only available from an external website? – Ulrike Fischer Feb 3 '19 at 16:39
• Now I understand: this font isn't a official one from Texlive. – Rodolfo FR Feb 4 '19 at 14:20

Put babyloniannum.sty in some place where TeX will find it, for instance in

/usr/local/texlive/texmf-local/tex/latex/babyloniannum


(in this case remember to run mktexlsr as superuser). Otherwise keep it in the work directory. Fetch the Santakku font and again place it in a suitable directory under texmf-local, or in the work directory. In the example below I used the latter approach.

Then fix the most obvious glitch in the package, which is using \fontspec at every call of \babyloniannum. It's much better to define a specific font face.

\documentclass{article}
\usepackage{fontspec}
\usepackage{babyloniannum}
\usepackage{etoolbox}

\let\babylonianfont\relax
\newfontface{\babylonianfont}{Santakku}[
Extension=.ttf,
Path=./,
]

\patchcmd{\babyloniannum}
{\fontspec{\babylonianfont}}
{\babylonianfont}
{}{}

\begin{document}

\babyloniannum{424000}
\babyloniannum{42}

\end{document}


There are also a couple of spurious spaces to be removed. Before editing, from

X\babyloniannum{424000}X\babyloniannum{42}X


I get

With the following edits (that make also redundant the suggested \patchcmd)

\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{babyloniannum}%%%% EDITED
[2011/08/19 0.5 Typeset Babylonian numerals with XeTeX and LuaTeX]
\ProvidesPackage{babyloniannum}
\RequirePackage{fontspec}
%\RequirePackage{xunicode}
\RequirePackage{numname}
\newcommand{\babylonianfont}{Santakku}
\newcommand{\unicodedisp}[1]{\char"#1}
\newcommand{\babylonian}[1]{%
\protect\babyloniannum{\arabic{#1}}}
\newcommand{\babylonianglyph}[1]{%
\ifnum #1 > \z@ % glyph is not zero
\chardef\m@mten=10 % cuts by units of 10
\numdigits{#1}% parse number
\ifcase\c@xsm@mctr %
\relax %
\or
\unicodedisp{1230B} %10
\or
\unicodedisp{1230B}\kern-0.15em{}\unicodedisp{1230B} %20 -- unknown?
\or
\unicodedisp{1230D} %30
\or
\unicodedisp{1240F} %40
\or
\unicodedisp{12410} %50
\fi
\ifnum \c@ism@mctr > \z@ %
\ifnum \c@xsm@mctr > \z@ %
\kern-0.5em{} % make glyphs closer
\fi %
\fi %
\ifcase\c@ism@mctr %
\or
\unicodedisp{12079} %1
\or
\unicodedisp{1222B} %2
\or
\unicodedisp{12408} %3
\or
\unicodedisp{120FB} %4
\or
\unicodedisp{1240A} %5
\or
\unicodedisp{1240B} %6
\or
\unicodedisp{1240C} %7
\or
\unicodedisp{1240D} %8
\or
\unicodedisp{1240E} %9
\fi
\else
\ifnum\c@baby@glyphs > \z@ %
\kern0.5em{}% empty space for zero
\fi
\fi
}
\newcounter{baby@ism@mctr}  % "units"
\newcounter{baby@xsm@mctr}  % "tens"
\newcounter{baby@csm@mctr}  % "hundreds"
\newcounter{baby@ksm@mctr}  % "thousands"
\newcounter{baby@xksm@mctr} % "ten thousands"
\newcounter{baby@cksm@mctr} % "hundred thousands"
\newcounter{baby@msm@mctr}  % "millions"
\newcounter{baby@xmsm@mctr} % "ten millions"
\newcounter{baby@cmsm@mctr} % "hundred millions"
\newcounter{baby@bsm@mctr}  % "billions"
\newcommand{\babylonian@setcounters}{%
\setcounter{baby@ism@mctr}{\c@ism@mctr}%
\setcounter{baby@xsm@mctr}{\c@xsm@mctr}%
\setcounter{baby@csm@mctr}{\c@csm@mctr}%
\setcounter{baby@ksm@mctr}{\c@ksm@mctr}%
\setcounter{baby@xksm@mctr}{\c@xksm@mctr}%
\setcounter{baby@cksm@mctr}{\c@cksm@mctr}%
\setcounter{baby@msm@mctr}{\c@msm@mctr}%
\setcounter{baby@xmsm@mctr}{\c@xmsm@mctr}%
\setcounter{baby@cmsm@mctr}{\c@cmsm@mctr}%
\setcounter{baby@bsm@mctr}{\c@bsm@mctr}%
}
\newcounter{baby@glyphs}%
\newcommand{\babyloniannum}[1]{%
\chardef\m@mten=60 % Cut by units of 60
\numdigits{#1}% Parse number
\babylonian@setcounters%
\mbox{%
\babylonianfont
\setcounter{baby@glyphs}{0}%
\babylonianglyph{\c@baby@bsm@mctr}%
\babylonianglyph{\c@baby@cmsm@mctr}%
\babylonianglyph{\c@baby@xmsm@mctr}%
\babylonianglyph{\c@baby@msm@mctr}%
\babylonianglyph{\c@baby@cksm@mctr}%
\babylonianglyph{\c@baby@xksm@mctr}%
\babylonianglyph{\c@baby@ksm@mctr}%
\babylonianglyph{\c@baby@csm@mctr}%
\babylonianglyph{\c@baby@xsm@mctr}%
\babylonianglyph{\c@baby@ism@mctr}%
}%
}
\endinput
%%
%% End of file babyloniannum.sty'.


the output is