[Tex/LaTex] Alignment of horizontal subfigures

floatshorizontal alignment

I have three images as subfigures. Two images are aligned happily, the first one doesn't line up. All images are the same size (519×346 pixels).

This is what it looks like:

Non-aligned images

I'd like to line up (a) (both image and caption) if possible, the way that (b) and (c) are.
This is the code to produce the currently-seen image:

\documentclass[11pt]{report} 
\usepackage[pdftex, demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htbp]
    \centering
    \begin{subfigure}[h]{0.3\textwidth}
        \includegraphics[width=\textwidth]{../Images/GloveOfDoom/RFIDTag_Testing_Side_s}
        \label{rfidtest_xaxis}
        \caption{Testing of the X-axis.}
    \end{subfigure}
    \begin{subfigure}[h]{0.3\textwidth}
        \includegraphics[width=\textwidth]{../Images/GloveOfDoom/RFIDTag_Testing_Vertical_s}
        \caption{Testing of the Y-axis.}
        \label{rfidtest_yaxis}
    \end{subfigure}
    \begin{subfigure}{0.3\textwidth}
        \includegraphics[width=\textwidth]{../Images/GloveOfDoom/RFIDTag_Testing_Other_s}
        \caption{Testing of the Z-axis.}
        \label{rfidtest_zaxis}
    \end{subfigure}
    \caption[RFID tag read-range testing]{RFID tag read-range testing setup. In all tests, the finger moves towards along an axis towards the tag.}
    \label{rfidtag_testing}
\end{figure}
\end{document}

Best Answer

First, the optional argument to the subfigure environment is the same as for minipage, so t(op), c(enter) or b(ottom), if I remember correctly, and this specifies the "anchor" I think, of the subfigure. Hence, h doesn't do anything.

Second, in the first subfigure you've placed the label before the caption, which creates the extra space between them (exactly why this happens, I'm not sure). The label should always be after or within the caption anyways, to get correct cross references.

Finally, graphicx generally figures out which driver to use on its own, so it's not necessary to specify pdftex (cf. Benedikt Bauer's comment).

enter image description here

\documentclass[11pt]{report} 
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htbp]
    \centering
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{../Images/GloveOfDoom/RFIDTag_Testing_Side_s}
        \caption{Testing of the X-axis.}
        \label{rfidtest_xaxis}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{../Images/GloveOfDoom/RFIDTag_Testing_Vertical_s}
        \caption{Testing of the Y-axis.}
        \label{rfidtest_yaxis}
    \end{subfigure}
    \begin{subfigure}[b]{0.3\textwidth}
        \includegraphics[width=\textwidth]{../Images/GloveOfDoom/RFIDTag_Testing_Other_s}
        \caption{Testing of the Z-axis.}
        \label{rfidtest_zaxis}
    \end{subfigure}
    \caption[RFID tag read-range testing]{RFID tag read-range testing setup. In all tests, the finger moves towards along an axis towards the tag.}
    \label{rfidtag_testing}
\end{figure}
\end{document}
Related Question