# Multiple figures per row with vertical label

I want to do something similar to what is done in this paper:

In particular I'm interested in:

1. Same amount of images per row
2. Using a vertical label to categorize each row
4. Wrapping the image (so there can be text on one side)

I've read some questions (here and here) but they are very different from what I want, can you help me?

I've tried this, but I'm getting errors:

\usepackage{subcaption} % for subfigures

\begin{table}[ht]
\begin{tabular}{ccc}
\begin{subfigure}{0.4\textwidth}\includegraphics[width=0.3\columnwidth]{Figures/all_souls_000021.jpg}&
\begin{subfigure}{0.4\textwidth}\includegraphics[width=0.3\columnwidth]{Figures/all_souls_000091.jpg}&
\begin{subfigure}{0.4\textwidth}\includegraphics[width=0.3\columnwidth]{Figures/oxford_000177.jpg}\\
\end{tabular}
\caption{A table with figures}
\label{tab:mytable}
\end{table}


Error:

! Missing } inserted.<inserted text>} ...olumnwidth]{Figures/all_souls_000021.jpg}&

• organize your images in table. in the first column you put your text (rotated), in other your images. – Zarko Jun 30 '17 at 9:45
• @Zarko I've tried your approach but I'm getting errors, could you give a look at my updated question? – user6321 Jun 30 '17 at 10:12
• pleas help us to help you!extend your code snippet to complete small (Minimal (non)Working Example: MWE) document beginning with \documentclass{...} and ending with \end{document} and load in preamble only necessary packages. It is not fun to recreate your document from scratch ... – Zarko Jun 30 '17 at 10:21
• What do you mean with wrapping the image? – Bernard Jun 30 '17 at 10:22
• @Bernard I mean like wrapfigure, where the "table of images" can be surrounded by text. – user6321 Jun 30 '17 at 10:23

With a handy interface:

\documentclass{article}
\usepackage{graphicx,xparse,booktabs}

\ExplSyntaxOn
\NewDocumentEnvironment{places}{mm}
{% #1 is the desired width, #2 is the number of photos per line
\setlength{\tabcolsep}{0pt} % no space between rows
\dim_set:Nn \l_places_width_dim
{
(#1-\ht\strutbox-\dp\strutbox-2pt)/(#2)
}
\begin{tabular}{r @{\hspace{2pt}} *{#2}{c}}
}
{
\end{tabular}
}

\NewDocumentCommand{\place}{mm}
{% #1 is the name of the place, #2 is the comma separated list of images
\seq_set_from_clist:Nn \l_places_images_in_seq { #2 }
\seq_set_map:NNn \l_places_images_out_seq \l_places_images_in_seq { \places_set_image:n {##1} }
\seq_put_left:Nn \l_places_images_out_seq
{
\begin{tabular}{c}\rotatebox[origin=c]{90}{\strut#1}\end{tabular}
}
\seq_use:Nn \l_places_images_out_seq { & } \\ \addlinespace
}

\dim_new:N \l_places_width_dim
\seq_new:N \l_places_images_in_seq
\seq_new:N \l_places_images_out_seq

\cs_new_protected:Nn \places_set_image:n
{
\makebox[\l_places_width_dim]
{
\begin{tabular}{c}
\includegraphics[
width=\l_places_width_dim,
height=\l_places_width_dim,
keepaspectratio,
]{#1}
\end{tabular}
}
}

\ExplSyntaxOff

\begin{document}

\begin{figure}[htp]
\centering

\begin{places}{\textwidth}{5}
\place{Hertford}{
example-image,
example-image-a,
example-image-b,
example-image-a,
example-image-b
}
\place{Pitt Rivers}{
example-image,
example-image-9x16,
example-image-b,
example-image-a,
example-image-b
}
\end{places}

\caption{Images}

\end{figure}

\begin{figure}[htp]
\centering

\begin{places}{.5\textwidth}{5}
\place{Hertford}{
example-image,
example-image-a,
example-image-b,
example-image-a,
example-image-b
}
\place{Pitt Rivers}{
example-image,
example-image-9x16,
example-image-b,
example-image-a,
example-image-b
}
\end{places}

\caption{Images}

\end{figure}

\end{document}


I suspect, that you like to have something like this:

but I'm not sure. The code snippet of above figure is:

    \begin{figure}
\setlength\tabcolsep{1pt}
\begin{tabularx}{\linewidth}{l XXX }
&   \includegraphics[width=\hsize,valign=m]{image-2}
&   \includegraphics[width=\hsize,valign=m]{image-5}
&   \includegraphics[width=\hsize,valign=m]{image-6}
\end{tabularx}
\caption{A table with figures}
\label{tab:mytable}
\end{figure}


In preamble of your document should be loaded (among others) the following packages:

\usepackage[demo]{graphicx}
\usepackage{booktabs, makecell, tabularx}
\usepackage{rotating}


Addendum: In the cases when you like to have images in "block" narrower then text width, than you need to prescribe narrower width of tabularx (not of figure environment, this you can't do on the way as you show in comment):

    \begin{figure}
\setlength\tabcolsep{1pt}
\begin{tabularx}{0.8\linewidth}{l XXX }% <-- here is determined table width

• Thanks, this is a very nice and simple solution. However, what if I want that this table doesn't take more than 80% text width? I tried with \begin{figure}{0.8\textwidth} but I'm getting ! Missing number, treated as zero.<to be read again>} \begin{figure}{0.8\textwidth} – user6321 Jun 30 '17 at 15:24