Vertical alignment of subfigures with different subcaptions length
Don't write t!
. The !
is used with float specifiers, but in this case the optional argument has to do with where to 'anchor' the subfigure. Remove all the !
and the subfigures are top-aligned.
Alternatively, as mentioned by Axel Sommerfeldt in the comments, you could use \subcaptionbox
, which automatically aligns the first lines of the subcaptions. By default, this will place the subcaptions on the same side of the figures as the main caption (in this case, above). To have the subcaption on the bottom, you can load subcaption
with the option position=b
, or use \captionsetup[subfigure]{position=b}
.
In the code below I added the \captionsetup
line within the second figure
environment, which makes the setting local to that figure
. By adding it to the preamble (or using \usepackage[position=b]{subcaption}
) the setting is global.
Finally, I also added \hfill
between the subfigure
s/subcaptionbox
es to space them out on the line. With your code, there was a normal interword space between them.
(The demo
option to graphicx
replaces all images with black rectangles.)
\documentclass[12pt, a4paper]{report}
\usepackage[demo]{graphicx}
\usepackage{mathtools}
\usepackage[hidelinks]{hyperref}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h!]
\centering
\caption{3D printed wax mould post processing}
\label{fig:Mould}
\begin{subfigure}[t]{0.3\linewidth}
\centering
\includegraphics[width=1\linewidth]{./Experimental/MouldWithSupport}
\caption{Just after removal from the 3D printer plate}
\label{fig:MouldWithSupport}
\end{subfigure}
\begin{subfigure}[t]{0.3\linewidth}
\centering
\includegraphics[width=1\linewidth]{./Experimental/MouldAfterWashing}
\caption{After removal of support wax and ultrasonic cleaning}
\label{fig:MouldAfterWashing}
\end{subfigure}
\begin{subfigure}[t]{0.3\linewidth}
\centering
\includegraphics[width=1\linewidth]{./Experimental/MouldAfterSilanization}
\caption{After silanization}
\label{fig:MouldAfterSilanization}
\end{subfigure}
\end{figure}
\begin{figure}[h!]
\captionsetup[subfigure]{position=b}
\centering
\caption{3D printed wax mould post processing}
\label{fig:Mould}
\subcaptionbox{Just after removal from the 3D printer plate\label{fig:MouldWithSupport}}{\includegraphics[width=.3\linewidth]{./Experimental/MouldWithSupport}}
\subcaptionbox{After removal of support wax and ultrasonic cleaning \label{fig:MouldAfterWashing}}{\includegraphics[width=.3\linewidth]{./Experimental/MouldAfterWashing}}
\subcaptionbox{After silanization \label{fig:MouldAfterSilanization}}{\includegraphics[width=.3\linewidth]{./Experimental/MouldAfterSilanization}}
\end{figure}
\end{document}
You could just insert \newline
to the shorter caption. Worked for me, the other solutions looked too complicated :)