6

While getting back into Latex for my Master thesis, I have a repetitive pattern of microscopy images that need to be arranged in 3 lines (with designated sample "names") and 3 columns, which I thought should be doable in Latex like in Powerpoint (see image). With using individual images to import and placing them in one figure as subfigures was no problem at all, but placing the names (A,B,C) in their position caused me to use a minipage-approach where i created a minipage for each name and image but spread the 3 lines apart across a whole page and I could not manage to position the names as intended. Does someone have an idea what strategy to use here in general? I have the feeling I am getting into the wrong directions and start beating a dead horse quite quickly. Eventually this would be useful for later work on writing papers, so help would be more than appreciated :-)

Thanks a lot in advance!

Envisioned Figure

  • Did you try using the floatrow package? It defines a subfloatrow environment, and a capposition=beside key. – Bernard Feb 16 at 23:05
  • Welcome to TeX.SE! Please consider posting a minimal working example with your question; it makes it a lot easier for people to help you. – dgoodmaniii Feb 16 at 23:17
5

Let me just repeat my above comment.

\documentclass{article}
\usepackage[export]{adjustbox}
\begin{document}
\begin{figure}
\centering
\begingroup
\newcommand{\InclGr}[1]{\includegraphics[width=2cm,height=2cm,valign=t]{#1}}%
\begin{tabular}{c@{~}*3{@{}c}}
A & \InclGr{example-image-duck} & \InclGr{example-image-duck} & \InclGr{example-image-duck}\\
B & \InclGr{example-image-duck} & \InclGr{example-image-duck} & \InclGr{example-image-duck}\\
C & \InclGr{example-image-duck} & \InclGr{example-image-duck} & \InclGr{example-image-duck}\\
\end{tabular}\endgroup
\end{figure}
\end{document}

enter image description here

|improve this answer|||||
9

You need nothing special:

\documentclass{article}
\usepackage[export]{adjustbox} % also loads graphicx

\begin{document}

\begin{figure}[htp]
\centering

\makebox[1em][l]{A}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\hspace{1pt}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\hspace{1pt}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\\
\makebox[1em][l]{B}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\hspace{1pt}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\hspace{1pt}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\\
\makebox[1em][l]{C}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\hspace{1pt}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\hspace{1pt}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}

\caption{The global caption\label{label}}

\end{figure}

\end{document}

The trick is valign=t, to obtain top alignment with respect to the letters.

Why 1pt? Because it's the default value of \lineskip.

enter image description here

A possible alternative with no space between the images and the block of images centered without keeping the letters into account.

\documentclass{article}
\usepackage[export]{adjustbox} % also loads graphicx

\begin{document}

\begin{figure}[htp]
\centering
\setlength{\lineskip}{0pt}

\makebox[0pt][r]{\makebox[1em][l]{A}}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\\
\makebox[0pt][r]{\makebox[1em][l]{B}}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}\\
\makebox[0pt][r]{\makebox[1em][l]{C}}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}%
\includegraphics[width=0.25\textwidth,valign=t]{example-image-1x1}

\caption{The global caption\label{label}}

\end{figure}

\end{document}

enter image description here

|improve this answer|||||
  • Thanks a lot! That solved the issue realy easily :-) – Rob Strasser Feb 18 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.