[Tex/LaTex] Figure and two subfigures side by side using caption/subcaption

floatssubcaptionsubfloats

I've looked at many questions asked here but I don't find quite what I want.

Here's roughly the desired output :enter image description here

i.e : On one line a Figure and side by side a Figure made of two subfigures. I don't really care about the alignment I just want it all to hold on one line.

I want to use the caption and subcaption packages. Here's what I've tried to do using the minipage environment.

\begin{minipage}{0.45\linewidth}
            \begin{wrapfigure}{r}{\linewidth}
            \centering
            \captionsetup{width=0.98\linewidth}
            \includegraphics[width=\linewidth]{path/figure1}
            \caption{Rainbow Gnome}
            \label{fig:gnome}
            \end{wrapfigure}
        \end{minipage}  
         \hspace{0.02\linewidth}    
        \begin{minipage}{0.45\linewidth}
            \begin{wrapfigure}{r}{\linewidth}   
            \begin{minipage}{0.45\linewidth}
                \centering
                \captionsetup{width=0.45\linewidth}
                \includegraphics[width=\linewidth]{path/shack}
                \subcaption{Mystery Shack}
                \label{fig:shack}
            \end{minipage}%
            \hspace{0.02\linewidth}
            \begin{minipage}{0.45\linewidth}
                \centering
                \captionsetup{width=0.45\linewidth}
                \includegraphics[width=\linewidth]{path/landscape}
                \subcaption{Nice Landscape}
                \label{fig:landscape}
            \end{minipage}%
                \caption{Gravity Falls}
                \label{fig:gravity}
            \end{wrapfigure}
        \end{minipage}

It's certainly not elegant and I get the first figure before one paragraph and the second one after the said paragraph..

All ideas welcome !

Best Answer

No wrapfigure: just a couple of minipages.

\documentclass{article}
\usepackage{graphicx,subcaption}

\begin{document}

\begin{figure}[htp]
\centering

\begin{minipage}[b]{0.38\textwidth} % almost 40%
\includegraphics[width=\textwidth]{example-image}

\caption{Rainbow gnome}
\end{minipage}%
\hspace{\stretch{2}}%
\begin{minipage}[b]{0.58\textwidth} % almost 60%
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{example-image-a}

\caption{Mystery shack}
\end{subfigure}%
\hfill
\begin{subfigure}{0.49\textwidth}
\includegraphics[width=\textwidth]{example-image-b}

\caption{Nice landscape}
\end{subfigure}

\caption{Gravity falls}
\end{minipage}

\end{figure}

\end{document}

enter image description here

Related Question