[Tex/LaTex] How to insert multiple images with captions in a non-floating environment

captionsfloatsgraphics

I'm writing my master thesis and I need to place a large number of images and tables, as in the following way:

\paragraph{name 1}

…long list of images and tables..

\paragraph{name 2}

…long list of images and tables..

in the way that the images are in their right position and don't change their position with respect to their own title, I choose to create non-floating images and tables. Besides, the totality of my figures are a combination of little images. For example, a piece of my code is:

\paragraph{name paragraph}

\begin{center}
\includegraphics[width=0.45\textwidth]{name figure 1}  \quad
\captionof*{figure}{partial caption figure 1} 
\includegraphics[width=0.45\textwidth]{name figure 2} 
\captionof*{figure}{partial caption figure 2}   
\captionof{figure}{Total caption }
\label{name_label}
\end{center}

In this way, I have a result where the images are not tiled horizontally, as I show in the figure attached:

in the top the result of my code

I want that the images are tiled horizontally, and this happens if I don't insert the partial caption at each image, as I show in the bottom of the image attached.

So, is there any solution of my problem? Is there another way to insert multiple images in a non-floating environment?

Best Answer

You can use minipages around the figures:

\documentclass{article}
\usepackage{caption}
\usepackage{graphicx}

\begin{document}

\paragraph{name paragraph}

\begin{center}
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\captionof*{figure}{partial caption figure 1}
\end{minipage}\hfill
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-b} 
\captionof*{figure}{partial caption figure 2}   
\end{minipage}
\captionof{figure}{Total caption }
\label{name_label}
\end{center}

\end{document}

enter image description here

In fact, I'd suggest you to use another minipage to surround the entire construct; otherwise, in some cases the general caption could land in a different page from the images:

\noindent\begin{minipage}{\textwidth}
\begin{center}
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-a}
\captionof*{figure}{partial caption figure 1}
\end{minipage}\hfill
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\linewidth]{example-image-b} 
\captionof*{figure}{partial caption figure 2}   
\end{minipage}
\captionof{figure}{Total caption }
\label{name_label}
\end{center}
\end{minipage}
Related Question