This is a wild one: can anyone write a code that converts a number into the corresponding word? e.g.:

4 -> 'four'
31 -> 'thirty-one'

and so on. Obviously, it is not enough to build an array in which you can store the numbers and the word associated with it and then just print instead of the number the stored word. What complicates matters more, are numbers like 11 ('eleven'). I intend to use it for numbering equations. So, anybody up to it?


You can use the fmtcount package to achieve that:



4: \numberstringnum{4}

31: \numberstringnum{31}


Use \Numberstringnum and \NUMBERstringnum respectively for capitalized and full-caps versions.

  • 2
    Concerning I18N: If \usepackage[ngerman]{babel} is in the document header, then the numbers are output in German. – feklee Oct 17 '13 at 14:12
  • 1
    @feklee and what should I do if language which I need in babel is not supported by this package? Package fmtcount Warning: No support for \numberstring for language 'lithuanian ' on input line 176. – holms Feb 29 '16 at 4:24

The moreenum package already does this as well.






enter image description here

Use \nthwords for lowercase. I think in the next version of the package, these will change to \nwords and \Nwords.

  • 3
    Hmmm... CTAN has a full documentation for fmtcount. The same is not true for moreenum. Plus fmtcount has more macros. Thanks anyway for your suggestion, I really appreciate you took your time to look into it! – Count Zero Sep 13 '11 at 15:21
  • texdoc moreenum gives me documentation; not sure why it's not showing up on CTAN. – frabjous Sep 13 '11 at 15:56
  • 1
    moreenum actually uses fmtcount internally. The documentation doesn't show up on that CTAN page, but if you click the CTAN directory link, you get moreenum-testcase.pdf which also serves as documentation. In fact, the package is simple enough that basically everything you need to know is in the readme anyway... – Seamus Nov 3 '11 at 8:28
  • Oh yeah. The version of moreenum on CTAN still has \nwords and \nthwords the wrong way round! The version on github has this fixed. I will upload a new version to CTAN today. (which will also have the documentation renamed so that CTAN finds it.) – Seamus Nov 3 '11 at 8:45

fmcount only works with numbers up to 100,000. For larger numbers, you will need to use numname which borrows the code from the memoir class. From what I recall, this can deal with bigger numbers. Neither the readme nor the package documentation actually tells you what the commands to use are, so here they are:

  • \numtoname turns a number into lowercase words (e.g. one)
  • \numtoName as above, but the first letter is capitalised
  • \NumToName as above but all words are capitalised
  • \ordinaltoname turns a number into lc ordinal (e.g. first)
  • \ordinaltoName as above but first letter capitalised
  • \OrdinalToName as above but all words capitalised

This package seems to manage all numbers up to TeX's limit of 2147483647. (numname helfully informs me that this is: two billion, one hundred and forty-seven million, four hundred and eighty-three thousand, six hundred and forty-seven)

  • How to remove the hyphen in thirty-one? – David Aug 26 '20 at 6:00
  • I haven't tested this, but from looking at numname.sty you could try adding \renewcommand*\tensunitsep{ } to your preamble (below having called numname – Seamus Aug 26 '20 at 9:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.