# Placing subfig vertically

There is a beautiful post where it is explained more or less what I would like to do.

Actually, I am not using subfigure, but \usepackage{subfig}. Therefore, I've tried to implement the example with the subfig solution. My entire document is using subfig, I would not change to subfigure now.

Here is the code I am using:

\begin{figure}[tb]
\centering
\sbox{\bigleftbox}{%
\begin{minipage}[b]{.5\textwidth}
\centering
\vspace*{\fill}
\subfloat[Image 1]
{\includegraphics[height=5cm]%
{images1}%
\label{image1}}
\end{minipage}%
}\usebox{\bigleftbox}%
\begin{minipage}[b][\ht\bigleftbox][s]{.5\textwidth}
\centering
\subfloat[Image 2]
{\includegraphics[width=0.9\linewidth]%
{images2}%
\label{image2}}
\vfill
\subfloat[Image 3]
{\includegraphics[width=0.9\linewidth]%
{images3}%
\label{image3}}
\end{minipage}
\caption{%
Figure}
\label{figure}
\end{figure}


In the attached picture I can see the result and it is not glorious. I would not like to change the change the size of the picture. The size shall remain the same. The problem is that 1) the left picture is not vertically centered with respect with the two other images, 2) the caption of the figure is not at the bottom of the last picture, and 3) the title of the next section is entering the figure.

How is it possible to solve all these problems using subfig and not subfigure?

I would be very thankful for your help.

• please extend your code snippet to complete document beginning with \documentclass{...} and ending with \end{document}. – Zarko Mar 12 at 18:16
• Using subfig and insisting in it in combination of the savebox an and the minipages makes the result and your demand really strange. If you really are open to use minipages, than the subcaption package should be enough for your approach and the subfig could not help somehere. – koleygr Mar 12 at 18:55
• In my above comment, I had understood that you expect the caption of the left figure aligned with the caption of the lower right figure and thus could not find a way that subfig package could be used for it (doesn't really use it often but if this was the case the subcaption package and the minipages should be enough). Commenting just to explain the above comment and to suggest to to have a look (whenever you find time) at the subcaption package that is better cooperating with minipages and such cases as this one. – koleygr Mar 12 at 19:51
• @koleygr Hi. Thanks a lot for the feedback. My entire document uses 'subfig'. Changing everything to 'subcaption' might take a bit of time. I will try to use 'subcaption' for my next documents. – Elfo2285 Mar 12 at 21:26

Your problem is different, as you don't have to measure anything.

In order to align the two parts at the top, you can use \raisebox{-\height}{...}.

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

\begin{document}

\begin{figure}[tbp]
\centering

\raisebox{-\height}{%
\subfloat[Image 1]{%
\includegraphics[height=5cm]{example-image-9x16}%
\label{image1}%
}%
\raisebox{-\height}{%
\begin{tabular}{@{}c@{}}
\subfloat[Image 2]{%
\includegraphics[width=0.4\textwidth]{example-image}%
\label{image2}%
} \\
\subfloat[Image 3]{%
\includegraphics[width=0.4\textwidth]{example-image}%
\label{image3}%
}
\end{tabular}%
}
\caption{Figure}
\label{figure}

\end{figure}

\end{document}


If you want to vertically center the left image:

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

\begin{document}

\begin{figure}[tbp]
\centering

\begin{tabular}{@{}c@{}}
\subfloat[Image 1]{%
\includegraphics[height=5cm]{example-image-9x16}%
\label{image1}%
}%
\begin{tabular}{@{}c@{}}
\subfloat[Image 2]{%
\includegraphics[width=0.4\textwidth]{example-image}%
\label{image2}%
} \\
\subfloat[Image 3]{%
\includegraphics[width=0.4\textwidth]{example-image}%
\label{image3}%
}
\end{tabular}

\caption{Figure}
\label{figure}

\end{figure}

\end{document}


• Using the tabular solution solved my problem. It makes the result I would like. Thanks a lot! – Elfo2285 Mar 12 at 19:32

\documentclass{article}
\usepackage{multirow,tabularx}
\usepackage{subfig}
\newsavebox\bigleftbox

\begin{document}
\begin{figure}[tb]
\centering
\begin{tabularx}{\linewidth}{XX}
\multirow[t]{2}{=}{\subfloat[Image 1 \label{image1}]%
{\includegraphics[height=5cm, valign=t]{images1}}%
}
&   \subfloat[Image 2 \label{image2}]%
{\includegraphics[height=\dimexpr2.5 cm-\baselineskip, valign=t]{images1}} \\
&   \subfloat[Image 3 \label{image3}]%
{\includegraphics[height=\dimexpr2.5 cm-\baselineskip, valign=b]{images1}} \\
\end{tabularx}
\caption{Figure}
\label{figure}


Here is a variant using minipages:

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

\begin{document}

\begin{figure}
\centering
\begin{minipage}[c]{0.3\textwidth}
\subfloat[Image 1]{%
\includegraphics[height=5cm]{example-image-9x16}%
\label{image1}%
}
\end{minipage}
\begin{minipage}[c]{0.4\textwidth}
\subfloat[Image 2]{%
\includegraphics[width=\textwidth]{example-image}%
\label{image2}%
}

\subfloat[Image 3]{%
\includegraphics[width=\textwidth]{example-image}%
\label{image3}%
}
\end{minipage}
\caption{Figure}
\label{figure}
\end{figure}

\end{document}