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.

In my document, the TikZ pictures have different bounding boxes so the two subfigures have staggered captions.

\documentclass{article}
\usepackage{standalone}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}{.4\linewidth}
\centering
\includestandalone{one}
\caption[short]{long}
\end{subfigure}
\begin{subfigure}{.4\linewidth}
\centering
\includestandalone{two}
\caption[short]{long}
\end{subfigure}
\end{figure}
\end{document}

Since you wont have my two standalones, I will show what is happening:

enter image description here

I would like for the subcaptions to start on the same row.

share|improve this question
1  
This should be supported out-of-the-box by supcaption. See, for example, the visual on p 6 of the subcaption documentation when using \subcaptionbox. If you replace your \includestandalone by something like \includegraphics[height=3\baselineskip]{example-image-a} and \includegraphics[height=2\baselineskip]{example-image-b}, do you still have mis-alignment vertically? –  Werner Aug 7 '13 at 22:42

1 Answer 1

up vote 4 down vote accepted

You can get the desired alignment using the \subcaptionbox command instead of the subfigure environment; the following example shows a comparison between subfigure with default vertical alignment, subfigure with bottom vertical alignment, and \subcaptionbox (the H option from float was only used for the example; I am not recommending using this placement specidier):

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{float}% just for the example

\begin{document}

Using \texttt{subfigure} with default vertical alignment (undesired result):
\begin{figure}[H]
\centering
\begin{subfigure}{.4\linewidth}
\centering
\includegraphics[height=2cm]{example-image-a}
\caption[short]{The left subfigure with a long caption spanning several lines and some more text}
\end{subfigure}
\begin{subfigure}{.4\linewidth}
\centering
\includegraphics[height=1cm]{example-image-b}
\caption[short]{The right subfigure}
\end{subfigure}
\end{figure}

Using \texttt{subfigure} with bottom alignment  (undesired result):
\begin{figure}[H]
\centering
\begin{subfigure}[b]{.4\linewidth}
\centering
\includegraphics[height=2cm]{example-image-a}
\caption[short]{The left subfigure with a long caption spanning several lines and some more text}
\end{subfigure}
\begin{subfigure}[b]{.4\linewidth}
\centering
\includegraphics[height=1cm]{example-image-b}
\caption[short]{The right subfigure}
\end{subfigure}
\end{figure}

Using \texttt{subcaptionbox}  (desired result):
\begin{figure}[H]
\centering
\subcaptionbox{The left subfigure with a long caption spanning several lines and some more text}%
  [.4\linewidth]{\includegraphics[height=2cm]{example-image-a}}
\subcaptionbox{The right subfigure}
  [.4\linewidth]{\includegraphics[height=1cm]{example-image-b}}
\end{figure}

\end{document}

enter image description here

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.