1

I'd like to have one figure floating over another in a subfigure environment. Following the answers already offered here (How to put a PDF figure on top of another one), I managed to place one over the other. However, I found no clue how I could fine adjust the position of a second figure, relative or absolute position. Let's say , I rather like the Legend figure to be positioned 1cm from the right and bottom of the border of Figure 1. How could I set that?

Here is my figure structure:

\begin{figure}[ht!]
\centering
\subcaptionbox{Figure 1}{
  \includegraphics[width=0.92\linewidth]{../Figure1.pdf}}
\llap{\raisebox{20mm}{\hspace{1cm}\includegraphics[height=35mm]{../Legend.pdf}}}
  \par\medskip
\subcaptionbox{Figure 2}{
  \includegraphics[width=0.45\linewidth]{../Figure2.jpg}
  }\medskip
\subcaptionbox{Figure 3}{
  \includegraphics[width=0.45\linewidth]{../Figure3.jpg}
  }
\caption{}
\end{figure}
1

The following should achieve your goal. Note the use of % in strategic spots to avoid spurious spaces.

enter image description here

\documentclass{article}

\usepackage{graphicx,subcaption}

\begin{document}

\begin{figure}
  \centering
  \subcaptionbox{Figure 1}{%
    \includegraphics[width=0.92\linewidth]{example-image-a}}%
  \makebox[0pt][r]{\raisebox{1cm}{\includegraphics[height=35mm]{example-grid-100x100pt}}\hspace{1cm}}

  \medskip

  \subcaptionbox{Figure 2}{%
    \includegraphics[width=0.45\linewidth]{example-image-b}%
  }\quad
  \subcaptionbox{Figure 3}{%
    \includegraphics[width=0.45\linewidth]{example-image-c}%
  }
  \caption{A figure}
\end{figure}

\end{document}

Your use of \medskip in horizontal mode actually puts the space between the two lower images and the \caption. I've changed that to \quad.

For completeness, I've used \makebox[0pt][r] instead of \llap (they achieve the same goal though).

  • I am sorry, but is there any difference between using subfigure environment and \subcaptionbox? – Diaa May 4 '17 at 0:26
  • 1
    @DiaaAbidou: The differences are minimal and may depend on your usage. This paste shows the difference when compiling similar content for a subfigure and a \subcaptionbox. The former doesn't align the first line of the sub-caption with one another, while the second does. – Werner May 4 '17 at 0:50
  • The difference is really noticeable in this case. Thanks for your explanation. – Diaa May 5 '17 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.