将两个数字并列

将两个数字并列

已经有几个线程处理这个问题:他们建议有一个图并将 minipages 放入其中,或者使用subcaption包并设置subfigure环境。但是,我尝试了这两种方法,但仍然出错:

\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}

答案1

不要在两个对象之间留空行;空行只是\par,因此第二个对象开始一个新段落:

\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}

在此处输入图片描述

请注意,我增加了 s 的宽度minipage并缩小了树的尺寸,以便它们可以并排放置而不会产生过满的\hboxs。

强者forest这个包可能会引起您的兴趣;它对于构建树非常灵活。

相关内容