0

For my thesis I want to show some pictures, like this: Image collage on A4

What is the best way to code this in overleaf?

So far I was able to get the pictures somewhat in the places I wanted them with the following code. However, I don't know how to get the Figure caption in between the pictures like I want it. I was able to put some text in the place where I want the figure caption, but if I write \caption{} in that place, it gives an error.

\begin{figure}
\centering

\begin{tabular}{@{} c c @{}}
  \begin{tabular}{@{} c  @{}}
    
    \includegraphics[width=0.48\textwidth]{Pictures/M&M/01_sampling.png} \\[10ex] 
    Text \\[1ex]
    \includegraphics[width=0.48\textwidth]{Pictures/M&M/06_sorting.png}
  \end{tabular}
  &
  \begin{tabular}{@{} c @{}}
    \includegraphics[width=0.48\textwidth]{Pictures/M&M/02_sampling.png} \\[1ex]
    \includegraphics[width=0.48\textwidth]{Pictures/M&M/03_sampling.png}\\[1ex]
    \includegraphics[width=0.48\textwidth]{Pictures/M&M/04_sampling.png}\\[1ex]
    \includegraphics[width=0.48\textwidth]{Pictures/M&M/05_sampling.png}
  \end{tabular}
\end{tabular}

\caption{}\label{whatever}
\end{figure}
Sofie
  • 3
  • 2

2 Answers2

0

So after some time I found this option which worked perfectly:

\begin{figure}[!htp]
\centering
\valign{#\cr
  \hsize=0.48\textwidth
  \subfloat{\includegraphics[width=\hsize]{Pictures/M&M/01_sampling.png}}\vfill
  \caption{Text}\vspace{5pt}
  \subfloat{\includegraphics[width=\hsize]{Pictures/M&M/06_sorting.png}}\cr
  \noalign{\hfill}
  \hsize=0.48\textwidth
  \subfloat{\includegraphics[width=\hsize]{Pictures/M&M/02_sampling.png}}\vfill
  \subfloat{\includegraphics[width=\hsize]{Pictures/M&M/03_sampling.png}}\vfill
  \subfloat{\includegraphics[width=\hsize]{Pictures/M&M/04_sampling.png}}\vfill
  \subfloat{\includegraphics[width=\hsize]{Pictures/M&M/05_sampling.png}}\cr
}
\end{figure}

From this post

Sofie
  • 3
  • 2
-1

Instead of using a tabular, I think using subfigures with subcaptions (https://www.overleaf.com/learn/latex/How_to_Write_a_Thesis_in_LaTeX_(Part_3)%3A_Figures%2C_Subfigures_and_Tables#Subfigures) may give better results. You can then add a subcaption to image 1 to get it below that image.

user2704177
  • 109
  • 2
  • 6
  • I don't know how to align the pictures the way I want them with subfigures. With subfigures it aligns two pictures beside each other, meaning that if I have one long picture beside a shorter picture there will be a blank space on top or below the short picture. I can't have two pictures on top of each other besides one long picture (see my example from question). Do you know a way to do this with subfigures? Hope it makes sense? Also the caption I can make below the first image does not say "Figure X" but (a)... – Sofie Jun 11 '23 at 15:35
  • You can alter the 'figure' or '(a)' by renewing the command (https://tex.stackexchange.com/questions/17489/change-caption-name-of-figures). For the positioning of the images, maybe using tikz works? (https://tex.stackexchange.com/questions/463170/making-photo-collage-using-tikz). Otherwise you can also save your images in one large image and use that. – user2704177 Jun 11 '23 at 19:05