Book Image

LaTeX Cookbook

By : Stefan Kottwitz
Book Image

LaTeX Cookbook

By: Stefan Kottwitz

Overview of this book

LaTeX is a high-quality typesetting software and is very popular, especially among scientists. Its programming language gives you full control over every aspect of your documents, no matter how complex they are. LaTeX's huge amount of customizable templates and supporting packages cover most aspects of writing with embedded typographic expertise. With this book you will learn to leverage the capabilities of the latest document classes and explore the functionalities of the newest packages. The book starts with examples of common document types. It provides you with samples for tuning text design, using fonts, embedding images, and creating legible tables. Common document parts such as the bibliography, glossary, and index are covered, with LaTeX's modern approach.You will learn how to create excellent graphics directly within LaTeX, including diagrams and plots quickly and easily. Finally, you will discover how to use the new engines XeTeX and LuaTeX for advanced programming and calculating with LaTeX. The example-driven approach of this book is sure to increase your productivity.
Table of Contents (19 chapters)
LaTeX Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. Start with any document class, such as article:

    \documentclass{article}
  2. Load the fmtcount package:

    \usepackage{fmtcount}
  3. Begin the document:

    \begin{document}
  4. 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.
  5. End the document:

    \end{document}
  6. Compile the document. All numbers...