Converting numbers to words
Numbers are sometimes written in words rather than using numerals. LaTeX is capable of automatically converting numbers to words. This is especially useful for values which originate from LaTeX counters, such as page or section numbers.
How to do it...
Load the fmtcount
package and use its commands for conversion:
- Start with any document class, such as
article
:\documentclass{article}
- Load the
fmtcount
package:\usepackage{fmtcount}
- Begin the document:
\begin{document}
- Write some text. Use the following instructions:
- Whenever you'd like to convert a number to a word, use the command
\numberstringnum
. - To print a counter value as a word, use
\numberstring
. - For a similar purpose, but in ordinal form, use
\ordinalstringnum
or\ordinalstring
. Let's take a look at the following commands:This document should have \numberstringnum{32} pages, now we are on page \numberstring{page} in the \ordinalstring{section} section.
- Whenever you'd like to convert a number to a word, use the command
- End the document:
\end{document}
- Compile the document...