我正在尝试绘制一个尖箭头,连接下面 tikzpicture 中的两棵树。到目前为止,我只成功绘制了一条红线,将其中一棵树连接到下一颗树的根节点,但是,我希望这条线是箭头,其头部位于下一颗树的根节点,但我不知道该怎么做。此外,我如何确保箭头不会穿过任何一棵树?
\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}
\begin{document}
\scalebox{.96}{
\begin{tikzpicture}[baseline=(current bounding box.center), every tree node/.style={align=center,anchor=north}, level distance = 10ex, sibling distance=.1cm, scale= 1]
\Tree [.{$\ref{interpretation3ha}$} [.{$s : s$} ] [.{$\textbf{t} $} [.{$u : p$} ] [.{$ \overline{\textbf{t}}$} [.{$(\eta \, (inductive))^{\bigstar}:$}\\{$ ((\overline{\textbf{e}} \,\overline{\textbf{t}}) \,\overline{\textbf{t}})\,\overline{\textbf{t}}$} \edge node[auto=left] {$\bigstar$}; [.{$ (\overline{\overline{\textbf{e}}\, \overline{\textbf{t}}})$} \edge node[auto=left] {$\eta$}; [.{$inductive : $}\\{$\overline{\textbf{e}}\, \overline{\textbf{t}}$} ] ] ] [.{$(\overline{\textbf{e}} \,\overline{\textbf{t}}) \,\overline{\textbf{t}}$} [. {$\lambda R:\overline{\textbf{e}} \,\overline{\textbf{t}}$} ] [.{$ \overline{\textbf{t}}$} [.{$(\textbf{e} \, \overline{\textbf{t}}) \overline{\textbf{t}}$} \edge node[auto=left] {$\bigstar$}; [.{$the.$}\\{$primes :$}\\{$ \overline{\textbf{e}}$} ] ] [.{$\textbf{e} (\overline{\textbf{t}})$} [.{$\lambda y$} ] [.\node(someone){$\overline{\textbf{t}}$} ; ] ] ] ] ] ] ]
\begin{scope}[xshift=-4cm,yshift=-9cm,scale=1] % the inverse scope tree is positioned 9 cm to the right and 8 cm down
\Tree [. \node(existential-inverse){$\overline{\textbf{t}}$}; [.{$h: e$} ] [.{$e\overline{\textbf{t}}$} [.{$prove$} ] [.{$\overline{\textbf{t}}$} \edge node[auto=left] {$\eta$}; [.{$\textbf{t}$} [.{$u :P$} ] [.{$\overline{\textbf{t}}$} [.{$\textbf{e}$} \edge node[auto=left] {$\eta$}; [.{$y : \textbf{e}$} ] ] [.{$\overline{\textbf{e}}\,\overline{\textbf{t}}$} [.{$not$} ] [.{$R: $}\\{$\overline{\textbf{e}} \, \overline{\textbf{t}}$} ] ] ] ] ] ] ] ]
\end{scope}
\draw[thick, color=red]
(someone)..controls +(-2,-3) and +(-2,-6)..(existential-inverse);
\end{tikzpicture}
}
\end{document}
答案1
类似这样的方法应该可以解决问题。我只是更改了控制点的值并添加了->
箭头。
\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,amssymb} % for the \text{} command that exits math mode
\usepackage[normalem]{ulem} % provides \sout
\usepackage{lscape}
\begin{document}
\scalebox{.96}{
\begin{tikzpicture}[baseline=(current bounding box.center), every tree node/.style={align=center,anchor=north}, level distance = 10ex, sibling distance=.1cm, scale= 1]
\Tree [.{$\ref{interpretation3ha}$} [.{$s : s$} ] [.{$\textbf{t} $} [.{$u : p$} ] [.{$ \overline{\textbf{t}}$} [.{$(\eta \, (inductive))^{\bigstar}:$}\\{$ ((\overline{\textbf{e}} \,\overline{\textbf{t}}) \,\overline{\textbf{t}})\,\overline{\textbf{t}}$} \edge node[auto=left] {$\bigstar$}; [.{$ (\overline{\overline{\textbf{e}}\, \overline{\textbf{t}}})$} \edge node[auto=left] {$\eta$}; [.{$inductive : $}\\{$\overline{\textbf{e}}\, \overline{\textbf{t}}$} ] ] ] [.{$(\overline{\textbf{e}} \,\overline{\textbf{t}}) \,\overline{\textbf{t}}$} [. {$\lambda R:\overline{\textbf{e}} \,\overline{\textbf{t}}$} ] [.{$ \overline{\textbf{t}}$} [.{$(\textbf{e} \, \overline{\textbf{t}}) \overline{\textbf{t}}$} \edge node[auto=left] {$\bigstar$}; [.{$the.$}\\{$primes :$}\\{$ \overline{\textbf{e}}$} ] ] [.{$\textbf{e} (\overline{\textbf{t}})$} [.{$\lambda y$} ] [.\node(someone){$\overline{\textbf{t}}$} ; ] ] ] ] ] ] ]
\begin{scope}[xshift=-4cm,yshift=-9cm,scale=1] % the inverse scope tree is positioned 9 cm to the right and 8 cm down
\Tree [. \node(existential-inverse){$\overline{\textbf{t}}$}; [.{$h: e$} ] [.{$e\overline{\textbf{t}}$} [.{$prove$} ] [.{$\overline{\textbf{t}}$} \edge node[auto=left] {$\eta$}; [.{$\textbf{t}$} [.{$u :P$} ] [.{$\overline{\textbf{t}}$} [.{$\textbf{e}$} \edge node[auto=left] {$\eta$}; [.{$y : \textbf{e}$} ] ] [.{$\overline{\textbf{e}}\,\overline{\textbf{t}}$} [.{$not$} ] [.{$R: $}\\{$\overline{\textbf{e}} \, \overline{\textbf{t}}$} ] ] ] ] ] ] ] ]
\end{scope}
\draw[thick, color=red, ->]
(someone)..controls +(-5,-5) and +(2,2)..(existential-inverse);
\end{tikzpicture}
}
\end{document}