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'm using the subcaptionpackage to have figures side-by-side. The problem is that the package aligns the figures to their subcaptions (should I be taking a hint for the package name?) rather than the top of the pictures.

How can I algin the subfigures by the top border?

MWE:

\begin{figure}[h]
\begin{subfigure}[b]{.5\linewidth}
\centering\large A
\caption{A subfigure}\label{fig:1a}
\end{subfigure}%
\begin{subfigure}[b]{.5\linewidth}
\centering\large B
\caption{Another subfigure with a long, long, long, long caption.}\label{fig:1b}
\end{subfigure}
\caption{A figure}\label{fig:1}
\end{figure}

Result: Subcaption example

share|improve this question

2 Answers 2

up vote 6 down vote accepted

I've tried to solve the problem in a different way, although in the package documentation I don't find any hint on this. Instead of adopting [b] I set [t]:

\documentclass[a4paper,11pt]{article}
\usepackage{subcaption}

\begin{document}
\begin{figure}[h]
\begin{subfigure}[t]{.5\linewidth}
\centering\large A
\caption{A subfigure}\label{fig:1a}
\end{subfigure}%
\begin{subfigure}[t]{.5\linewidth}
\centering\large B
\caption{Another subfigure with a long, long, long, long caption.}\label{fig:1b}
\end{subfigure}
\caption{A figure}\label{fig:1}
\end{figure}    

\end{document}

that leads to:

enter image description here

The reason of my choice was just a parallel with t,b of columns alignment in Beamer.

share|improve this answer
    
Regarding the missing hint: It's "the new environments subfigure and sub-table are available, which have the same (optional & mandatory) arguments as the minipage environment." in the documentation. Will try to make this more clear in the next version... –  Axel Sommerfeldt May 18 '12 at 6:17
    
@AxelSommerfeldt: thanks! Now it's clear to me. :) –  Claudio Fiandrino May 18 '12 at 7:25
    
@AxelSommerfeldt: I couldn't figure it out for the life of me :) –  benregn May 18 '12 at 7:43
1  
@benregn This won't align the subcaptions to each other if the figures have different height. –  egreg May 18 '12 at 17:57
    
@egreg: I'll keep that in mind. In the specific case that prompted the question, it is not a problem. –  benregn May 19 '12 at 12:08

You can use a trick that fools LaTeX into thinking that the first subcaption is as high as the second, but doesn't add to the width:

\subcaption{A subfigure\vspace{\baselineskip}}

Of course, leave this kind of adjustments for the final revision of the document, when you're sure that the text won't change any more.

share|improve this answer

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.