# Subfigures within minipage

I have 5 figures, which I want to display in one page, after dividing it in three minipages. Idellay I have 2 subfigures in the first minipage, 2 in the second one, and only one in the third minipage center-aligned.

I tried the following:

\documentclass[a4paper,10pt]{article}
\usepackage[demo]{graphicx}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage[paper=letterpaper,left=1.0in,right=1.0in,top=0.25in,bottom=1.0in,]{geometry}

\begin{document}

\begin{figure}
\begin{minipage}{03.\textheight}
\centering
\begin{subfigure}[a]{\includegraphics[width=.5\linewidth] {./pngs/profile_L_3lambda_max_1wl_0.png}
\label{fig:subfig1}
}%
\end{subfigure}
\begin{subfigure}[b]{\includegraphics[width=.5\linewidth]{./pngs/profile_L_3lambda_max_1wl_dft_0.png}
\label{fig:subfig2}
}%
\end{subfigure}
\label{fig:myfigure}
\end{minipage}

\begin{minipage}{03.\textheight}
\centering
\begin{subfigure}[c]{\includegraphics[width=.5\linewidth] {./pngs/profile_L_3lambda_max_1wl_0.png}
\label{fig:subfig1}
}%
\end{subfigure}
\begin{subfigure}[d]{\includegraphics[width=.5\linewidth]{./pngs/profile_L_3lambda_max_1wl_dft_0.png}
\label{fig:subfig2}
}%
\end{subfigure}
\label{fig:myfigure}
\end{minipage}

\begin{minipage}{03.\textheight}
\centering
\begin{subfigure}[f]{\includegraphics[width=\linewidth] {./pngs/profile_L_3lambda_max_1wl_0.png}
\label{fig:subfig1}
}%
\end{subfigure}
\caption{My caption}
\end{minipage}

\end{figure}


Unfortunately, the result is totally hopeless. Any suggestion on how to fix it? Thanks in advance

• Watch out, not \begin{minipage}{03.\textheight}, it is \begin{minipage}{0.3\textheight} – ferahfeza Apr 15 at 13:25
• @ferahfeza. You are right. thanks. However, Figures come one after the other. I cannot obtain two figures in the first minipage, two in the second and one in the third. Any suggestion on this issue? – Dario Apr 15 at 13:41
• Do you want to obtain the two figures side by side in minipage? – ferahfeza Apr 15 at 13:59
• delete empty lines between minipages. however, do you really need minipages? you can obtain desired result also without using them. – Zarko Apr 15 at 14:00
• @ferahfeza Indeed. – Dario Apr 15 at 14:00

• the package subfigure is obsolete. it is replaced with subfig. however, even better is to use the subcaption package.
• i would not use minipage for grouping your sub figures, this can be done without them:

\documentclass[a4paper,10pt]{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\usepackage{amsmath}
\usepackage[paper=letterpaper,
left=1.0in,right=1.0in,
top=0.25in,bottom=1.0in,]{geometry}

\begin{document}
\begin{figure}
\centering
\begin{subfigure}{0.45\linewidth}
\includegraphics[width=\linewidth]{./pngs/profile_L_3lambda_max_1wl_0.png}
\caption{}
\label{fig:subfig1}
\end{subfigure}\hfil
\begin{subfigure}{0.45\linewidth}
\includegraphics[width=\linewidth]{./pngs/profile_L_3lambda_max_1wl_dft_0.png}
\caption{}
\label{fig:subfig2}
\end{subfigure}

\smallskip
\begin{subfigure}{0.45\linewidth}
\includegraphics[width=\linewidth]{./pngs/profile_L_3lambda_max_1wl_0.png}
\caption{}
\label{fig:subfig3}
\end{subfigure}\hfil
\begin{subfigure}{0.45\linewidth}
\includegraphics[width=\linewidth]{./pngs/profile_L_3lambda_max_1wl_dft_0.png}
\caption{}
\label{fig:subfig4}
\end{subfigure}

\smallskip
\begin{subfigure}{0.45\linewidth}
\includegraphics[width=\linewidth]{./pngs/profile_L_3lambda_max_1wl_0.png}
\caption{}
\label{fig:subfig5}
\end{subfigure}

\caption{My caption}
\label{fig:my-figures}
\end{figure}
See Fig.~\ref{fig:my-figures}, particularly sub figure \ref{fig:subfig5} \dots
\end{document}


• @Dario, you are welcome! – Zarko Apr 15 at 14:23