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

Arranging images in a grid


A larger set of photos, plots, or diagrams could be loaded by using the \includegraphics command with some space in between, possibly arranged using the minipage environments. A for loop may help if the file names can be generated.

In this recipe, we will produce a grid of aligned images with arbitrary names easy to arrange.

How to do it...

We will use a tabular environment for positioning. That's no surprise yet. However, we will read in the tabular cell content, which we will then use as file names for inclusion. The collcell package provides the required feature. Let's take a look at the following steps:

  1. Load the graphicx package and the collcell package:

    \usepackage{graphicx}
    \usepackage{collcell}
  2. Define a command for including an image with chosen width and height:

    \newcommand{\includepic}[1]{\includegraphics[width=3cm,
      height=2cm,keepaspectratio]{#1}}
  3. Define a new column type that uses that new command in its column specification. We use the letter i for image...