Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have three images as subfigures. Two images are aligned happily, the first one doesn't line up. All images are the same size (519x346 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}
share|improve this question
    
The [h] option is unknown and ignored; you should use [b] –  egreg Dec 21 '12 at 12:09
    
Just a remark: it shouldn't be necessary to give the graphicx package a pdftex oprtion –  Benedikt Bauer Dec 21 '12 at 12:10
add comment

1 Answer

up vote 8 down vote accepted

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.

enter image description here

\documentclass[11pt]{report} 
\usepackage[pdftex, 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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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