I want three subfigures to be shown next to each other so that the subcaptions of all three subfigures are equally 'wide'. I'm experiencing 2 problems.
-
Since my middle subfigure is a lot smaller, the subcaption of this figure is stretched out vertically. I want all the subcaptions, however, to have the same width.
-
Since the sizes of the images differ, the images are displayed very strangely. I would like the two outer ones to start at the same height and the middle one to be centered (same distance above and under the image as well as at the sides, relative to the outer images).
I've already been playing with \hspace
, \vspace
, and \hfill
, but this seems to have no effect. The output result I keep obtaining:
My code
\documentclass[master=elt,masteroption=eg]{kulemt}
\usepackage{color}
\usepackage{amsmath,amsfonts,amssymb}
\everymath{\displaystyle}
\numberwithin{equation}{section}
\usepackage{graphicx}
\graphicspath{{./Images/}}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{natbib}
\bibpunct{[}{]}{;}{a}{,}{,}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\vspace{0.05\textheight}
\includegraphics[width=\textwidth]{OriginalImage}
\caption{An original set of pixels making up an object}
\label{OriginalImage}
\end{subfigure}%
~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.1\textwidth}
\vspace{0.08\textheight}
\hspace{0.2\textwidth}
\includegraphics[width=\textwidth]{StructuringElement}
\caption{The structuring element used for the closing}
\label{StructuringElement}
\hspace{0.2\textwidth}
\end{subfigure}
~ %add desired spacing between images, e. g. ~, \quad, \qquad etc.
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.3\textwidth}
\vspace{0.05\textheight}
\includegraphics[width=\textwidth]{ClosedImage}
\caption{The closed image}
\label{ClosedImage}
\end{subfigure}
\caption{The closing of an object}\label{Closing}
\end{figure}
\end{document}
Best Answer
I changed to class
article
so that I could work with it. One of the primary things was to change the width of all three subfigures to be the same. Also, subfigures were invoked with top, not bottom, alignment. Once that was done, the middle figure's width/height, when expressed as a fraction of\textwidth
, had to be changed (I also used\hfil
and\hfill
to center it). Finally, a\raisebox
was needed to raise the middle figure.