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 ...

Get LaTeX Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.