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

Aligning numeric data


Standard alignment options in table columns are left, right, and centered. In cases of numeric values, this might not be sufficient. The only way to keep number magnitudes comparable is aligning digits at certain positions, such as at the ones, thousands, or millions places, or at decimal points. Integers can simply be right aligned. Numbers with decimal fractions could be filled up with zeroes to get decimal points aligned, but that would add vacuous noise.

In the case of fractions, it's good to directly align at the decimal points. In this recipe, we will implement this.

How to do it...

The siunitx package is, first of all, intended for typesetting values with units consistently. Incidentally, supporting its primary purpose, it provides a tabular column type for aligning at decimal points. We will use this now:

  1. Load the siunitx package in your preamble:

    \usepackage{siunitx}
  2. Use S as the column specifier for a column with alignment at decimal points, such as:

    \begin{tabular...