Converting numbers to words
Numbers are sometimes written as text instead of using numerals. LaTeX is capable of automatically converting numbers to words. This feature is especially useful for values originating from LaTeX counters, such as page or section numbers.
How to do it...
We will load the fmtcount package and use its commands for conversion.
- Start with any document class, such as the article class:
\documentclass{article}
- Load the fmtcount package:
\usepackage{fmtcount}
- Begin the document:
\begin{document}
- Write some text. Proceed the following way:
- Whenever you like to convert a number to a word, use the command \numberstringnum.
- For printing a counter value as a word, use \numberstring.
- For a similar purpose, but in ordinal form, use \ordinalstringnum or \ordinalstring.
Enter the following lines to practice the new commands:
This document should have \numberstringnum{32} pages. Now, we are on page \numberstring{page} in the \ordinalstring{section} section...