7

I'm trying to achieve an effect like

 _____    ___   ___
|     |  |___| |___|
|     |   ___
|_____|  |___|

but I can't get it to allgn correctly to the top. I tried with two minipages, the second table into a minipage, but to no avail

Here is my code

\begin{figure}
    \centering
    \begin{tabular}{cc}
        \begin{subfigure}[t]{0.5\textwidth}
            \centering
            \includegraphics[width=\linewidth]{figures/LDAoT_synth/A/chains.png}
        \end{subfigure} &
        \begin{tabular}{cc}
            \begin{subfigure}[t]{0.25\textwidth}
                \centering
                \includegraphics[width=\linewidth]{figures/LDAoT_synth/A/errors.png}
            \end{subfigure} &
            \begin{subfigure}[t]{0.25\textwidth}
                \centering
                \includegraphics[width=\linewidth]{figures/LDAoT_synth/A/cosine_errors.png}
            \end{subfigure} \\
            \begin{subfigure}[t]{0.25\textwidth}
                \centering
                \includegraphics[width=\linewidth]{figures/LDAoT_synth/A/hellinger_errors.png}
            \end{subfigure} &
        \end{tabular}
    \end{tabular}
\end{figure}

Here is what I get

unaligned images

How can I fix it?

Addendum:

How could I get this?

 _____    ___   ___
|     |  |___| |___|
|     |   ___   ___
|_____|  |___| |___|
 ____   ____   ____
|____| |____| |____|
Makers_F
  • 173

2 Answers2

5

You don't need subcaption if you have no subcaption to the images.

Here's a way, by measuring the big picture. In the example I use \scalebox just to have the big picture higher than two small ones.

\documentclass{article}

\usepackage{graphicx}

\newbox{\bigpicturebox}

\begin{document}

\begin{figure}
\centering

\sbox{\bigpicturebox}{%
  \scalebox{1}[1.2]{\includegraphics[width=.45\textwidth]{example-image}}%
}

\usebox{\bigpicturebox}\hfill
\begin{minipage}[b][\ht\bigpicturebox][s]{.45\textwidth}
\includegraphics[width=.45\textwidth]{example-image-a}\hfill
\includegraphics[width=.45\textwidth]{example-image-b}

\vfill

\includegraphics[width=.45\textwidth]{example-image-c}
\end{minipage}

\medskip
\includegraphics[width=.225\textwidth]{example-image-a}\hfill
\includegraphics[width=.225\textwidth]{example-image-b}\hfill
\includegraphics[width=.225\textwidth]{example-image-c}

\end{figure}

\end{document}

enter image description here

Here is a version with subcaptions; add the \label commands you need.

\documentclass{article}

\usepackage{subcaption}
\usepackage{graphicx}

\newbox{\bigpicturebox}

\begin{document}

\begin{figure}
\centering

\sbox{\bigpicturebox}{%
  \begin{subfigure}[b]{.45\textwidth}
  \scalebox{1}[1.2]{\includegraphics[width=\textwidth]{example-image}}%
\caption{Big picture}
\end{subfigure}
}

\usebox{\bigpicturebox}\hfill
\begin{minipage}[b][\ht\bigpicturebox][s]{.45\textwidth}
\begin{subfigure}{.45\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Small figure}
\end{subfigure}\hfill
\begin{subfigure}{.45\textwidth}
\includegraphics[width=\textwidth]{example-image-b}
\caption{Small figure}
\end{subfigure}

\vfill

\begin{subfigure}[b]{.45\textwidth}
\includegraphics[width=\textwidth]{example-image-c}
\caption{Small figure}
\end{subfigure}
\end{minipage}

\bigskip

\begin{subfigure}{.3\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Small figure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\textwidth]{example-image-b}\hfill
\caption{Small figure}
\end{subfigure}\hfill
\begin{subfigure}{.3\textwidth}
\includegraphics[width=\textwidth]{example-image-c}
\caption{Small figure}
\end{subfigure}

\end{figure}

\end{document}

enter image description here

egreg
  • 1,121,712
  • Nice, I like your solution more... – Rmano Apr 02 '16 at 16:32
  • I did not put captions in the example, but I'll have to refer to the images with a label and thus I need a caption. How would that work with captions? – Makers_F Apr 02 '16 at 16:39
  • Yes, put it into a figure and use the subcaption package. – Rmano Apr 02 '16 at 16:49
  • @Makers_F Added the subcaptions – egreg Apr 02 '16 at 16:59
  • Works. I also added a small figure under B at the right of C, in that case I had to add [t] to the bottom boxes. Only one last thing: the image + the caption take slightly more than half of a page. I tried putting the content (except the caption) inside a scalebox to resize it slightly and be able to fit 2 of those images per page, but the layout gets messed up. Do you have a suggestion to fix that? Could a minipage allow me to use the scalebox? Eventually I will have to learn how latex really works! :D – Makers_F Apr 02 '16 at 21:02
  • 1
    @Makers_F Careful usage of [t] or [b] is necessary for getting the desired alignment. About the size, you can decrease the width of each figure. – egreg Apr 02 '16 at 21:04
  • How can I do the same with subfigure instead of subcaptions ? – user7867665 Jun 25 '19 at 13:10
  • @user7867665 subfigure has been obsolete for 15 years; its replacement is subfig. Please ask a new question referring to this one. – egreg Jun 25 '19 at 13:19
  • @egreg okay I will ask for an implementation with subfig – user7867665 Jun 25 '19 at 14:54
  • @egreg https://tex.stackexchange.com/questions/497367/big-picture-with-several-smaller-ones-on-the-side-with-subfigure-subfig – user7867665 Jun 25 '19 at 15:01
  • In the subcaption version how do you add a caption without it saying "table" – user7867665 Jun 25 '19 at 18:10
2

This is a straightforward approach with tabular. I am shifting down the includegraphics box so that the reference is on the top margin of the figure in the first tabular. It needs a bit of manual adjusting, though --- surely it can be done better.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{tabular}{@{}cc@{}}
    \raisebox{-\height}{\includegraphics[width=0.45\textwidth]{example-image-a}} & 
    \begin{tabular}[t]{@{}cc@{}}
        \raisebox{-\height}{\includegraphics[width=0.2\textwidth]{example-image-b}} & 
        \raisebox{-\height}{\includegraphics[width=0.2\textwidth]{example-image-b}} \\[1.8cm]
        \raisebox{-\height}{\includegraphics[width=0.2\textwidth]{example-image-b}} & 
    \end{tabular}
\end{tabular}

\bigskip

\begin{tabular}{@{}ccc@{}}
    \includegraphics[width=0.3\linewidth]{example-image-a} &
    \includegraphics[width=0.3\linewidth]{example-image-a} &
    \includegraphics[width=0.3\linewidth]{example-image-a} 
\end{tabular}

\end{document}

result of aligned boxes

Rmano
  • 40,848
  • 3
  • 64
  • 125
  • I see this is inside the document. Can I put it inside a figure, so that it is float and can have a caption? – Makers_F Apr 02 '16 at 16:36
  • With caption and subcaption package you should be able to solve it... at least in @egreg 's version – Rmano Apr 02 '16 at 16:45