# Align captions of subfigures:

Hi I want to include the following two tikz figures in my document:

\documentclass{article}

\usepackage{tikz}
\usepackage{subcaption}

\begin{document}
\begin{figure}
\begin{subfigure}[l]{.46\textwidth}
\centering
\resizebox{.8\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2,minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size = 0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\end{tikzpicture}%
}
\caption{Goldbeter-Koshland Loop.}
\end{subfigure}
\begin{subfigure}[r]{.46\textwidth}
\resizebox{.8\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-1.5,0) {$P$};
\node[protein] (ps) at (1.5,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2, minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size =0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\node[protein] (q) at (0 , -3) {$Q$};
\node[protein] (qs) at (3 , -3) {$Q^*$}
edge [towards, bend left] node[below=10pt,name=e3, minimum size =0mm] {$E_3$} (q)
edge [from,bend right] node[above=10pt,name=e4,minimum size =0mm] {} (q) ;
\draw[->] (ps) -- +(0pt,-50pt);
\draw[->] (e3) -- +(0pt,12pt);
\end{tikzpicture}%
}
\end{subfigure}
\end{figure}

\end{document}


Everything is as I want it except that the caption in the two subfigures are not aligned.

Thanks for the help.

-
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. –  Peter Grill Nov 2 '12 at 20:45
using \begin{subfigure}[b]{.46\textwidth} puts the captions at the bottom, but it also changes the justification of the figures- I assume that is not the desired output? there have been a few questions similar to this- I'll try and find the links –  cmhughes Nov 2 '12 at 20:49
I think somebody edited the code I did not use the b option. Anyway this partially works, but the what I'd like more is to have the captions aligned at the bottom and the two tikzfigures aligned vertically.. –  lucacerone Nov 2 '12 at 20:57
Sorry Peter In the rush to post I forgot to include the \documentclass and the packages. –  lucacerone Nov 2 '12 at 20:57
@LucaCerone my apologies, I edited the link with my 'partial' fix; you've confirmed what I thought you wanted though :) –  cmhughes Nov 2 '12 at 21:08

You can let the floatrow package do the hard work for you:

\documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}
\usepackage{floatrow}

\begin{document}

\begin{figure}
\ffigbox
{%
\begin{subfloatrow}
\ffigbox[\FBwidth][1.5\FBheight]
{\caption{Goldbeter-Koshland Loop.}}
{\resizebox{.4\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2,minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size = 0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\end{tikzpicture}%
}}%
\ffigbox[\FBwidth]
{\resizebox{.4\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-1.5,0) {$P$};
\node[protein] (ps) at (1.5,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2, minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size =0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\node[protein] (q) at (0 , -3) {$Q$};
\node[protein] (qs) at (3 , -3) {$Q^*$}
edge [towards, bend left] node[below=10pt,name=e3, minimum size =0mm] {$E_3$} (q)
edge [from,bend right] node[above=10pt,name=e4,minimum size =0mm] {} (q) ;
\draw[->] (ps) -- +(0pt,-50pt);
\draw[->] (e3) -- +(0pt,12pt);
\end{tikzpicture}%
}}%
\end{subfloatrow}}{}
\end{figure}

\end{document}


-

You can use

\begin{subfigure}[b]{.46\textwidth}


and this gets us part of the way there, but not all the way- we still need to do some work!

We would ideally like to put in some \vfill commands that would put in the necessary white space around the smaller of the two subfigures. In order to do this successfully, we need to measure the size of the larger subfigures which can be done by storing it in a box.

So, the approach below does the following:

• stores the second (largest) picture in a sbox called \tempbox
• measures the height of the \tempbox and then applies the necessary amount of \vfill surrounding it to the first (smaller) subfigure

\documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}

\newsavebox{\tempbox}

\begin{document}

\begin{figure}
% store the bigger of the two pictures in a vbox
\sbox{\tempbox}{%
\resizebox{.368\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-1.5,0) {$P$};
\node[protein] (ps) at (1.5,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2, minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size =0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\node[protein] (q) at (0 , -3) {$Q$};
\node[protein] (qs) at (3 , -3) {$Q^*$}
edge [towards, bend left] node[below=10pt,name=e3, minimum size =0mm] {$E_3$} (q)
edge [from,bend right] node[above=10pt,name=e4,minimum size =0mm] {} (q) ;
\draw[->] (ps) -- +(0pt,-50pt);
\draw[->] (e3) -- +(0pt,12pt);
\end{tikzpicture}%
}
}
\begin{subfigure}[b]{.46\textwidth}
\centering
\vbox to\ht\tempbox{
\vfill
\resizebox{.8\textwidth}{!}{%
\begin{tikzpicture}
[bend angle =60,inner sep=0pt, minimum size =10mm,very thick,
from/.style={<-},
towards/.style={->},
protein/.style={circle,draw=black,very thick},
reaction/.style={}]
\node[protein] (p) at (-2,0) {$P$};
\node[protein] (ps) at (2,0) {$P^*$}
edge [towards, bend left] node[below=10pt,name=e2,minimum size =0mm] {$E_2$} (p)
edge [from,bend right] node[above=10pt,name=e1,minimum size = 0mm] {$E_1$} (p) ;
\draw[->] (e1) -- +(0pt,-12pt);
\draw[->] (e2) -- +(0pt,12pt);
\end{tikzpicture}%
}
\vfill
}
\caption{Goldbeter-Koshland Loop.}
\end{subfigure}
\begin{subfigure}[b]{.46\textwidth}
\usebox{\tempbox}