How do I create a 3x3 matrix of Images with a letter at the beginning of each line?
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
.
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}
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}