I need to extend the following sequence of roman,arabic,babyloniannum to hieroglyphs. The solution for LaTeX has been given elsewhere but is very cumbersome. Also, it doesn't do the grouping of numerals of the same class.


I'm looking for a Unicode with the use of XeTeX version which should be very straightforward. That is in at most **ordinary 5 lines of code.**

EDIT This question is not a duplicate of this question at all. The answer there doesn't use Unicode which I expect to use here. Tha author of the answer there has stated in fact that he is unable to write an Unicode answer to my problem.

More precisely I need to use that Unicode has those precomposed glyphs for Egyptian digits. For example, 6,000 is U+131C1. XeTeX can use them with fontspec. But I do not know how do I create this U+131C1 in my file ideje.tex. I hope the situation is clearer now?

enter image description here

  • 2
    Your question is very unclear. Most of the code in the linked answer could be put into a package and therefore the fact that it appears cumbersome to you is irrelevant. The grouping problem would be better described with a minimal example using that code and showing what the desired output would be. Furthermore, the issue seems to have very little to do with Unicode, other than the source of the glyphs themselves, which has nothing to do with generating the correct sequence of them corresponding to a number. And stating a maximum!? number of lines of code makes no sense.
    – Alan Munn
    Oct 5, 2019 at 22:06
  • 1
    this seems to be a duplicate of, or at most a comment on, the question you just asked tex.stackexchange.com/questions/511099/hieroglyphs-numerals Oct 5, 2019 at 22:45
  • 1
    I am not sure what you mean by "how do I create this U+131C1 in my file ideje.tex" that seems to be just a question about your editor, you can just type it in as character data (๐“‡) or use ^^^^131c1 tex notation, or \symbol{"131C1} for example. Oct 6, 2019 at 11:10
  • 1
    well clearly you need a font with the characters, I have no idea which (but I assume any google search for these characters would suggest a suitable font. On my windows machine here firefox shows the character that I used in the previous comment with Segoe UI Historic (which I think is a standard Windows font, so I could use that in xetex via fontspec. Oct 6, 2019 at 11:28
  • 1
    Does unicode do the grouping? How? if you would accept a package that does the mapping of the numbers then the 5 line comment really makes no sense at all as any code given can be saved to a package, and there are very few packages with less than 5 lines Oct 6, 2019 at 11:40

2 Answers 2


enter image description here

I had to guess some of the unicode mappings, just looking at


\newfontfamily\hg{Segoe UI Historic}











  • Works fine! However see this. Oct 6, 2019 at 14:54
  • You have typos in the definition of \hgtens ;-) Oct 11, 2019 at 15:42
  • I blame @UlrikeFischer Oct 11, 2019 at 15:43

Iโ€™ll repost my answer using Unicode. Itโ€™s not as terse as requested, because it uses expl3, but neither is David Carslisleโ€™s fine answer.

Here is a solution using fontspec and expl3. Itโ€™s not very compact, but in my opinion, itโ€™s a lot more readable than the legacy solution.


% These fonts are available at: http://users.teilar.gr/~g1951d/
\newfontfamily\hieroglyphfont{Aegyptus}[Scale = MatchUppercase, Script={Egyptian Hieroglyphs}]
\newfontfamily\emojifont{Symbola}[Scale = MatchUppercase] % The modern equivalent.

\newcommand\EgyptianShrug{{\hieroglyphfont ๐“€ }}


\regex_new:N \c_up_to_seven_digits_regex
\regex_set:Nn \c_up_to_seven_digits_regex { ^\d{1,7}$ }

\cs_new:Npn \hiero_numeral:n #1
           { \int_mod:nn {\int_div_truncate:nn {#1} {1000000}} {10} }
           {% This is anachronistic; ancient Egyptians did not typically write ๐“จ๐“จ
           { \int_mod:nn {\int_div_truncate:nn {#1} {100000}} {10} }
           {% Also anachronistic.
           { \int_mod:nn {\int_div_truncate:nn {#1} {10000}} {10} }
           { \int_mod:nn {\int_div_truncate:nn {#1} {1000}} {10} }
           { \int_mod:nn {\int_div_truncate:nn {#1} {100}} {10} }
           { \int_mod:nn {\int_div_truncate:nn {#1} {10}} {10} }
           { \int_mod:nn {#1} {10} }

\cs_generate_variant:Nn \hiero_numeral:n { e }




\hg{1132641} (1132641)

\hg{4037} (4037)

\hg{NaN} (NaN)


Aegyptus Sample

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .