1

I have a figure with two subfigures of different heights. I'd like the subcaptions to align at the bottom. This could probably be done with some kind of alignment stuff, or by creating a phantom '[RTR]' branch of the left subfigure's tree. I'm unsure how to do either of these.

\usepackage[linguistics]{forest}
\begin{figure}
\centering
\begin{subfigure}[t]{.45\textwidth}
  \centering
\begin{forest}
 [, GP1, s sep=2em
[\large{è} [open [close [rtr]]]]
  ]
\end{forest}
\caption{left caption}
\end{subfigure}%
\hfill
\begin{subfigure}[t]{.4\textwidth}
  \centering
\begin{forest}
 [, GP1, s sep=2em
[\large{ɛ́ɛ̀} [open [close [rtr, calign=child, calign primary child=2 [{[RTR]}] ]]]]
  ]
\end{forest}}
\caption{right caption}
\end{subfigure}%
\caption{Figure caption} 
\end{figure}

misaligned subcaptions

  • 1
    Normally captions are aligned using subfigure [b] (default), but I assume you want to keep the tikzpicture at the top. See https://tex.stackexchange.com/questions/477406/subfloat-how-to-align-subcaption-of-image-to-same-elevation-as-other-subcaption. – John Kormylo Mar 08 '19 at 17:35
  • floatrow can do this. – cfr Oct 01 '19 at 17:05

2 Answers2

1

Maybe not the most elegant solution, but you could use minipages to get the desired alignment:

enter image description here

\documentclass{article}
\usepackage{subcaption}

\usepackage[linguistics]{forest}
\begin{document}
\begin{figure}
\centering
\begin{minipage}[t]{.45\textwidth}
  \centering
\begin{forest}
 [, GP1, s sep=2em
[\large{ee} [open [close [rtr]]]]
  ]
\end{forest}

\end{minipage}%
\hfill
\begin{minipage}[t]{.4\textwidth}
  \centering
\begin{forest}
 [, GP1, s sep=2em
[\large{e} [open [close [rtr, calign=child, calign primary child=2 [{[RTR]}] ]]]]
  ]
\end{forest}%}
\end{minipage}

\begin{subfigure}[t]{.45\textwidth}
\caption{right caption}
\end{subfigure}
\hfill
\begin{subfigure}[t]{.4\textwidth}
\caption{left caption}
\end{subfigure}
\caption{Figure caption} 
\end{figure}

\end{document}
leandriis
  • 62,593
0

Unfortunately I can't get your code to work fully but you could try adding a negative space before your second "tree", something like the following to align the trees at the bottom instead of adding space between the tree and its caption.

Edit: you can change the \subfigure[t] to \subfigure[b] to achieve the same.

enter image description here

\documentclass{article}
\usepackage{subcaption}
\usepackage[linguistics]{forest}

\begin{document}
\begin{figure}
\centering
\begin{subfigure}[t]{.45\textwidth}
  \centering
\begin{forest}
 [, GP1, s sep=2em
[\large{è} [open [close [rtr]]]]
  ]
\end{forest}
\caption{left caption}
\end{subfigure}%
\hfill
\begin{subfigure}[t]{.4\textwidth}
\vspace{-1.1cm}  %                  <---- added here. Adjust spacing to your needs
  \centering
\begin{forest}
 [, GP1, s sep=2em
[\large{ɛ́ɛ̀} [open [close [rtr, calign=child, calign primary child=2 [{[RTR]}] ]]]]
  ]
\end{forest}}
\caption{right caption}
\end{subfigure}%
\caption{Figure caption} 
\end{figure}
\end{document}

OR

\documentclass{article}
\usepackage{subcaption}
\usepackage[linguistics]{forest}

\begin{document}
\begin{figure}
    \centering
    \begin{subfigure}[b]{.45\textwidth}
        \centering
        \begin{forest}
            [, GP1, s sep=2em
            [\large{è} [open [close [rtr]]]]
            ]
        \end{forest}
        \caption{left caption}
    \end{subfigure}%
    \hfill
    \begin{subfigure}[b]{.4\textwidth}
        \centering
        \begin{forest}
            [, GP1, s sep=2em
            [\large{ɛ́ɛ̀} [open [close [rtr, calign=child, calign primary child=2 [{[RTR]}] ]]]]
            ]
    \end{forest}
    \caption{right caption}
\end{subfigure}%
\caption{Figure caption} 
\end{figure}
\end{document}
Superuser27
  • 1,312