Posted by: Dave Richeson | August 30, 2012

Ancient number systems in XeTeX

I am teaching a history of mathematics class this semester. We are beginning with a brief discussion of ancient number systems: Egyptian, Babylonian, Mayan, Chinese, Incan, GreekRoman, and Hindu-Arabic. As I was writing up the first homework assignment it occured to me that I should investigate whether these numbers could be typeset using LaTeX.

It quickly became apparent that, because fonts are involved, I would have to use XeTeX rather than LaTeX. It was a fun (although time consuming) exercise. In the end I was able to typeset Egyptian hieroglyphics, Babylonian cuneiform, and Chinese rod numerals. Because the syntax was often messy, I spent a while burying the complicated TeX in the headers so that the numbers would be easy to work with in the document.

For example, to generate the Egyptian hieroglyphics for 123 I write


The fraction 1/123 is


To express 123 in cuneiform all I have to write is


To create a number board with the Chinese counting rods representing 123 I type

\Cnum{|x|x|x|}{\Cvone & \Chtwo & \Cvthree}.

If you would like to give this a try, download my .tex files:

egyptian.tex and egyptian.pdf

babylonian.tex and babylonian.pdf

chinese.tex and chinese.pdf

I’d love to be able to do something similar with the Mayan numbers. I tried for a while, but couldn’t get them to work.

Disclaimer: I know my way around TeX pretty well, but I’m not a power user. It took me quite a while to get all this to work. I’m not sure I can offer much trouble-shooting advice if you can’t get this to work on your computer.



  1. That’s quite cool! We don’t offer a “History of Mathematics” type course at my college…but I’ll file this post away just in case we eventually do.

  2. I don’t have a reason to use this right now, but this is so cool. Thanks for sharing.

  3. This is great! Thanks for sharing.

  4. Hi Professor Richeson, is it possible that you can share that History of Mathematics course with us?, maybe the reading list, the topics that you cover, some lectures notes, whatever.

    • A few people have asked me that. Unfortunately, for day-to-day operations everything is on Moodle (our CMS), and thus it requires a password. But I’ll see what I can do at the end of the semester. It would be nice to do something like you suggest.

  5. About Mayan numbers : your difficulty probably comes from the fact that they are not yet encoded in unicode. However, LaTeX packages exists to type Mayan and Epi-Olmec . Since both these writing systems use the same mesoamerican numbers, you can probably use any of the 2 packages for your purpose.

    • Thanks! I’ll be sure to look at those links.


%d bloggers like this: