[Tex/LaTex] Put two figures side by side

floatsminipagesubcaption

There are already several threads that deal with this: they suggest having one figure and putting putting minipages inside, or using the subcaption package and having subfigure environments. However, I've tried both of these approaches and I'm still going wrong:

\begin{figure}[h]

\begin{minipage}[b]{0.2\linewidth}

\begin{tikzpicture}[sibling distance=0pt]
\Tree [.TP
        [.DP \edge[roof]; {a 'we'} ]
        [.T$'$
            [.T \node(li){li 'eat$_i$'}; ]
            [.VP
                [.Spec t ]
                [.V$'$ 
                    [.DP \edge[roof]; {saka 'rice'} ]
                    [.V \node(t){t$_i$}; ] ] ] ] ]
\draw [->] (t) .. controls +(south:3) and +(south:3) .. (li);
\end{tikzpicture}

\end{minipage}\hfill

\begin{minipage}[b]{0.2\linewidth}

\begin{tikzpicture}[sibling distance=0pt]
\Tree [.TP
        [.DP \edge[roof]; {a 'we'} ]
        [.T$'$
            [.T \node(li){la 'have'}; ]
            [.VP
                [.Spec t ]
                [.V$'$ 
                    [.DP \edge[roof]; {saka 'rice'} ]
                    [.V \node(t){li 'eaten'}; ] ] ] ] ]
\draw [red,->] (t) .. controls +(south:3) and +(south:3) .. (li);
\end{tikzpicture}

\end{minipage}

\end{figure}

Best Answer

Do not leave blank lines between the two objects; a blank line is just \par, so the second object starts a new paragraph:

\documentclass{article}
\usepackage{tikz-qtree}

\begin{document}

\begin{figure}
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tikzpicture}[scale=.85,sibling distance=0pt]
\Tree [.TP
        [.DP \edge[roof]; {a 'we'} ]
        [.T$'$
            [.T \node(li){li 'eat$_i$'}; ]
            [.VP
                [.Spec t ]
                [.V$'$ 
                    [.DP \edge[roof]; {saka 'rice'} ]
                    [.V \node(t){t$_i$}; ] ] ] ] ]
\draw [->] (t) .. controls +(south:3) and +(south:3) .. (li);
\end{tikzpicture}
\end{minipage}% <- this is important here
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tikzpicture}[scale=.85,sibling distance=0pt]
\Tree [.TP
        [.DP \edge[roof]; {a 'we'} ]
        [.T$'$
            [.T \node(li){la 'have'}; ]
            [.VP
                [.Spec t ]
                [.V$'$ 
                    [.DP \edge[roof]; {saka 'rice'} ]
                    [.V \node(t){li 'eaten'}; ] ] ] ] ]
\draw [red,->] (t) .. controls +(south:3) and +(south:3) .. (li);
\end{tikzpicture}
\end{minipage}
\end{figure}

\end{document}

enter image description here

Notice that I increased the width for the minipages and scaled down the trees so they fit side by side without producing overfull \hboxes.

The powerful forest package could be of interest for you; it's very versatile for building trees.