树木和其下方的树木

树木和其下方的树木

问题

  1. 我怎样才能在照片中标记了树 2 的空白处(位于树 1 的正下方,但在 的右侧\Rightarrow)放置一棵树?
  2. 我如何为树 1 和树 2 添加标题(分别将它们标记为“表面范围”和“逆范围”)?
  3. 我怎样才能使它变得\Rightarrow更大?
  4. 我怎样才能将从“每个人”和“某人”到树 1 中的\foralland绘制的红线包含在内?\exists
  5. 我怎样才能将我在树 1 的各个部分周围放置的大蓝色圆圈及其标签(“NP”和“VP”)包括在内?
  6. 我怎样才能将“每个人”和“某人”用另一条线连接到新创建的树 2 的\forall和节点?\exists

句法树和语义树 1 的图像(表面范围)

在此处输入图片描述

句法树和语义树的代码 1(表面范围)

\documentclass[12pt,a4paper]{article}   
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{ulem}
\usepackage{calc}
\newsavebox\CBox
\newcommand\hcancel[2][0.5pt]{%
    \ifmmode\sbox\CBox{$#2$}\else\sbox\CBox{#2}\fi%
    \makebox[0pt][l]{\usebox\CBox}%  
    \rule[0.5\ht\CBox-#1/2]{\wd\CBox}{#1}}

\begin{document}

\rotatebox{90}{
\begin{tikzpicture}[baseline=(current bounding box.center)]
\Tree
[.TP
   [.DP [.Everyone ] ]
   [.T\1
       [.T ]
       [.AspP
           [.Asp ]
           [.\emph{v}P
               [.\emph{v} ]
               [.VP
                   [.V hugs ]
                   [.DP [. someone ]
                        ]
                       ] 
                   ]
               ]
           ]
       ]
   ]    
]
\end{tikzpicture}
$\Rightarrow$ 
\begin{tikzpicture}[baseline=(current bounding box.center), scale=.8]
\Tree
[.{$<$t$_{1}$,\hspace{0.1cm} \\$\lbrack$ $\emptyset$ $\rbrack$, \\$\lbrack$ $\emptyset$ $\rbrack$  $>$}
    [.{$<$(e$_{2}$ $\rightarrow$ t$_{1}$) $\rightarrow$ t$_{1}$),\hspace{0.1cm} \\$\lbrack$ e$_{3}$ $\rbrack$ $>$}
        \node(wh){$\forall$} ;  ]
    [.{$<$(e$_{2}$ $\rightarrow$ t$_{1}$),\hspace{0.1cm} \\$\lbrack$ \hcancel{e$_{3}$}  $\thinspace$ $\rbrack$, \\$\lbrack$ $\emptyset$ $\rbrack$  $>$}
        [. \node (ne) {e$_{2}$}; ]
        [.{$<$t$_{1}$,\hspace{0.1cm} \\$\lbrack$ e$_{2}$  $\rbrack$, $\lbrack$ $\emptyset$  $\rbrack$ $>$}
            [.{$<$(e$_{3}$ $\rightarrow$ t$_{1}$) $\rightarrow$ t$_{1}$),\hspace{0.1cm} \\$\lbrack$ e$_{2}$ $\rbrack$, \\$\lbrack$ $\emptyset$ $\rbrack$  $>$}
                \node(wh){$\exists$} ; ]
            [.{$<$(e$_{3}$  $\rightarrow$ t$_{1}$), \hspace{0.1cm} \\$\lbrack$ e$_{2}$ $\rbrack$, \hspace{0.1cm} \\$\lbrack$ \hcancel{e$_{3}$}  $\thinspace$ $\rbrack$ $>$ }
                [. \node (ue) {e$_{3}$}; ]
                [.{$<$t$_{1}$, \hspace{0.1cm} \\$\lbrack$ e$_{2}$ $\rbrack$, \hspace{0.1cm} \\$\lbrack$ e$_{3}$ $\rbrack$ $>$ }
                    [. \node [circle,draw] (me)  {e$_{2}$ } ; ]
                    [.{$<$(e$_{2}$  $\rightarrow$ t$_{1}$), \hspace{0.1cm} \\$\lbrack$ e$_{3}$ $\rbrack$ $>$}
                        [.{$<$(e$_{3}$ $\rightarrow$ e$_{2}$  $\rightarrow$ t$_{1}$),\hspace{0.1cm} \\$\lbrack$ $\emptyset$ $\rbrack$ $>$} ]
                        [. \node [circle,draw] (le) {e$_{3}$}; ]
                    ]
                ]
            ]
        ]
    ]
]
\draw[semithick, dashed, ->] 
  (le)..controls +(south west:5) and +(south:5) .. (ue);
\draw[semithick, dashed, ->]
  (me)..controls +(south west:3) and +(south:3) .. (ne);
\end{tikzpicture}
}

\end{document}

语义树 2 的图像(逆范围)

在此处输入图片描述

语义树 2 的代码(逆范围)

\documentclass[12pt,a4paper]{article}   
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usepackage{ulem}
\usepackage{calc}
\newsavebox\CBox
\newcommand\hcancel[2][0.5pt]{%
    \ifmmode\sbox\CBox{$#2$}\else\sbox\CBox{#2}\fi%
    \makebox[0pt][l]{\usebox\CBox}%  
    \rule[0.5\ht\CBox-#1/2]{\wd\CBox}{#1}}

\begin{document}

\begin{tikzpicture}[baseline=(current bounding box.center), scale=.8] 
\Tree
    [.{$<$t$_{1}$,\hspace{0.1cm} \\$\lbrack$ $\emptyset$ $\rbrack$ $>$}
        [.{$<$(e$_{3}$ $\rightarrow$ t$_{1}$) $\rightarrow$ t$_{1}$),\hspace{0.1cm} \\$\lbrack$ $\emptyset$ $\rbrack$ $>$}
            \node(wh){$\exists$} ; ]
        [.{$<$(e$_{3}$  $\rightarrow$ t$_{1}$), \hspace{0.1cm} \\$\lbrack$ \hcancel{e$_{3}$} $\thinspace$ $\rbrack$ $>$ }
            [. \node (ue) {e$_{3}$};  ]
            [.\node[draw]{{$<$t$_{1}$, \hspace{0.1cm} \\$\lbrack$ e$_{3}$ $\rbrack$ $>$ }}; 
                [.{$<$(e$_{2}$  $\rightarrow$ t$_{1}$)$\rightarrow$ t$_{1}$), \hspace{0.1cm} \\$\lbrack$ e$_{3}$ $\rbrack$ $>$}
                    \node(wh){$\forall$}; ]
                [.{$<$(e$_{2}$  $\rightarrow$ t$_{1}$), \hspace{0.1cm} \\$\lbrack$ e$_{3}$ $\rbrack$ $>$}
                    [.{$<$(e$_{3}$ $\rightarrow$ e$_{2}$ $\rightarrow$ t$_{1}$),\hspace{0.1cm} \\$\lbrack$ e$_{3}$  $\rbrack$ $>$} ]
                    [. \node [circle,draw] (le) {e$_{3}$} ; ]
                ]
            ]
        ]
    ]
\draw[semithick, dashed, ->] 
    (le)..controls +(south west:5) and +(south:5) .. (ue);
\end{tikzpicture}

\end{document}

答案1

输出

在此处输入图片描述

答案

请参阅代码中的注释以获得进一步的解释,但这里是我如何回答您的问题的摘要:

  1. 我在语义树的代码周围使用了\begin{scope}和,这样它们就可以独立缩放和移动。表面范围树有,因此它向右移动了 9 厘米,缩小了 20%。反向范围树有,因此它向右移动了 9 厘米,向下移动了 8 厘米,缩小了 20%。\end{scope}[xshift=9cm,scale=.8][xshift=9cm,yshift=-8cm,scale=.8]
  2. 我将其用作\node at (5,1.5) {\textbf{Surface Scope}};第一个语义树的标题。此节点的定位与环境tikz内的坐标系有关scope。逆范围树也使用了类似的节点。
  3. \Rightarrow放置在它自己的scope环境中,因此它可以相对于整体进行移动tikzpicture,并且我放入\Huge节点文本以增加箭头的大小。
  4. 由于三棵树都在同一个 中tikzpicture,因此你可以用引用不同树中命名节点的线将它们连接起来。例如,我在表面范围树中包含全称量词的节点命名为(universal-surface),然后将\draw[thick, color=red] (everyone)..controls +(0,-9) and +(0,-8)..(universal-surface);其与句法树中的节点连接起来(everyone)
  5. 通过使用该fit库,您可以在指定的一组节点周围放置形状。例如,\node [draw=blue, ellipse, thick, inner sep=-4pt, fit = (root-surface) (NPleft-surface) (NPright-surface)] {};在名为 、 和 的节点周围放置一个蓝色椭圆(root-surface)(NPleft-surface)蓝色(NPright-surface)标签是使用相对于树中命名节点定位的节点添加的。
  6. 在句法树和逆作用域树之间画线与在句法树和表面作用域树之间画线完全相同。

代码

我通过为您的有序集合、类型、括号元素等定义命令,大大清理了您的树的代码。这样,您只需调整命令定义的格式,它就会应用于整个树。

\documentclass[12pt,a4paper]{article}   
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\usetikzlibrary{fit,shapes} % tikz libraries that are necessary to make the blue ellipses
\usepackage{amsmath} % for the \text{} command that exits math mode
\usepackage[normalem]{ulem} % provides \sout
\usepackage{lscape} % for page rotation

% Custom commands to clean the code up
\newcommand{\ord}[1]{\ensuremath{\langle#1\rangle}} % for your ordered sets; you can change back to < > if you want
\newcommand{\type}[2]{\ensuremath{\text{#1}_{#2}}} % for your types
\newcommand{\br}[1]{\ensuremath{\lbrack \thinspace #1 \thinspace \rbrack}} % for your bracketed elements
\newcommand{\arr}{\ensuremath{\rightarrow}} % shorter macro for the arrow
\newcommand{\stm}[1]{\ensuremath{\text{\sout{$#1$}}}} % a strikeout command that words in math mode

% commands for the three types you're using
\newcommand{\tone}{\type{t}{1}}
\newcommand{\etwo}{\type{e}{2}}
\newcommand{\ethree}{\type{e}{3}}

\begin{document}

\begin{landscape}
\scalebox{.96}{ % scales the entire contents
\begin{tikzpicture}[baseline=(current bounding box.center)]
\Tree
    [.TP
        [.DP
            [.\node(everyone){Everyone}; % label nodes you want to draw lines/arrows to or from
            ]
        ]
        [.T\1
            [.T
            ]
            [.AspP
                [.Asp
                ]
                [.\emph{v}P
                    [.\emph{v}
                    ]
                    [.VP
                        [.V hugs 
                        ]
                        [.DP 
                            [.\node(someone){someone};
                            ]
                        ]
                    ] 
                ]
            ]
        ]
    ]
\begin{scope}[xshift=5.5cm,yshift=-4cm] % use scope to be able to shift parts of the tikzpicture around and scale them independently of the rest of the tikzpicture
\node {\Huge$\Rightarrow$}; % put the arrow in a node and make it \Huge
\end{scope}
\begin{scope}[xshift=9cm,scale=.8] % shift the first tree 9 cm to the right
\Tree
    [.\node(root-surface){$\ord{\tone, \br{\emptyset}, \br{\emptyset}}$};
        [.\node(NPleft-surface){$\ord{(\etwo \arr \tone) \arr \tone), \br{\ethree}}$};
            [.\node(universal-surface){$\forall$};
            ]
        ]
        [.$\ord{(\etwo \arr \tone), \br{\stm{\ethree}}, \br{\emptyset}}$
            [.\node(ne-surface){$\etwo$};
            ]
            [.\node(NPright-surface){$\ord{\tone, \br{\etwo}, \br{\emptyset}}$};
                [.\node(VPleft-surface){$\ord{(\ethree \arr \tone) \arr \tone, \br{\etwo}, \br{\emptyset}}$};
                    [.\node(existential-surface){$\exists$};
                    ]
                ]
                [.$\ord{(\ethree \arr \tone), \br{\etwo}, \br{\stm{\ethree}}}$
                    [.\node(ue-surface){$\ethree$};
                    ]
                    [.$\ord{\tone, \br{\etwo}, \br{\ethree}}$
                        [.\node [circle,draw] (me-surface) {$\etwo$}; 
                        ]
                        [.$\ord{(\etwo \arr \tone), \br{\ethree}}$
                            [.$\ord{(\ethree \arr \etwo \arr \tone), \br{\emptyset}}$
                            ]
                            [. \node [circle,draw] (le-surface) {$\ethree$};
                            ]
                        ]
                    ]
                ]
            ]
        ]
    ]
\draw[semithick, dashed, ->, >=stealth] 
    (le-surface)..controls +(-1,-1) and +(0,-4) .. (ue-surface);
\draw[semithick, dashed, ->, >=stealth]
    (me-surface)..controls +(-1,-1) and +(0,-4) .. (ne-surface);
% the caption node is positioned relative to the scope
\node at (5,1.5) {\textbf{Surface Scope}};
% draw a blue ellipse around the nodes listed after fit =, tweak inner sep to make it slightly bigger/smaller
\node [draw=blue, ellipse, thick, inner sep=-4pt, fit = (root-surface) (NPleft-surface) (NPright-surface)] {}; 
\node [draw=blue, ellipse, thick, inner sep=-5pt, fit = (VPleft-surface) (le-surface)] {};
% position the label of the ellipses to relative to one of the named nodes in the tree
\node [above=1cm, right=1cm] at (NPright-surface) {\color{blue} NP}; 
\node [above=1.5cm, right=0.5cm] at (le-surface) {\color{blue} VP};
\end{scope}

\begin{scope}[xshift=9cm,yshift=-8cm,scale=.8] % the inverse scope tree is positioned 9 cm to the right and 8 cm down
\Tree
    [.$\ord{\tone, \br{\emptyset}}$
        [.$\ord{(\ethree \arr \tone) \arr \tone), \br{\emptyset}}$
            [.\node(existential-inverse){$\exists$};
            ]
        ]
        [.$\ord{(\ethree \arr \tone), \br{\stm{\ethree}}}$
            [.\node(ue-inverse){$\ethree$};
            ]
            [.\node[draw]{$\ord{\tone, \br{\ethree}}$};
                [.$\ord{(\etwo \arr \tone) \arr \tone), \br{\ethree}}$
                    [.\node(universal-inverse){$\forall$};
                    ]
                ]
                [.$\ord{(\etwo \arr \tone), \br{\ethree}}$
                    [.$\ord{(\ethree \arr \etwo \arr \tone), \br{\ethree}}$
                    ]
                    [.\node [circle,draw] (le-inverse) {$\ethree$};
                    ]
                ]
            ]
        ]
    ]
\draw[semithick, dashed, ->, >=stealth]
    (le-inverse)..controls +(-2,-1) and +(0,-4) .. (ue-inverse);
\node at (5,1) {\textbf{Inverse Scope}};
\end{scope}
% These are the red lines, drawn between nodes in different scopes
\draw[thick, color=red]
    (someone)..controls +(0,-2) and +(-1,-1)..(existential-inverse);
\draw[thick, color=red]
    (someone)..controls +(0,-2) and +(0,-3)..(existential-surface);
\draw[thick, color=red]
    (everyone)..controls +(0,-10) and +(-1,-1)..(universal-inverse);
\draw[thick, color=red]
    (everyone)..controls +(0,-9) and +(0,-8)..(universal-surface);
\end{tikzpicture}
}
\end{landscape}

\end{document}

相关内容