如何在两棵树之间添加虚线,如下图所示,
\begin{center}
\begin{tabular}{p{4cm}p{4cm}}
\tikzset{my dbl/.style={double,double distance=2pt}}
\centering
\begin{forest}
for tree={edge=thick,calign=fixed edge angles}
[a
[b
[b,edge=my dbl]
[$\ast$
[d]
]
]
]
%[\subnode{marke}{e},draw,dashed]
\end{forest} &
\tikzset{my dbl/.style={double,double distance=2pt}}
\centering
\begin{forest}
for tree={edge=thick,calign=fixed edge angles}
[\subnode{markh}{a},name=a,tikz={\node [fit=() (!1)]}
[b,edge=my dbl
[d]
]
[$\ast$
[d,edge=my dbl]
]
]
\end{forest}
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\draw[green](marke.east)--(markh.west);
%\draw [-stealth](a) to[bend right] (b.west);
\end{tikzpicture}
\end{center}
这是我目前的代码。没有任何效果。
答案1
正如解释的那样这个答案,您可以使用\subnode
s,它们在您的代码中已经存在(但已被注释掉)。
\documentclass{article}
\usepackage[edges]{forest}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{center}
\begin{tabular}{p{4cm}p{4cm}}
\tikzset{my dbl/.style={double,double distance=2pt}}
\centering
\begin{forest}
for tree={edge=thick,calign=fixed edge angles}
[\subnode{marka1}{a}
[b
[b,edge=my dbl]
[$\ast$
[d]
]
]
]
\end{forest} &
\tikzset{my dbl/.style={double,double distance=2pt}}
\centering
\begin{forest}
for tree={edge=thick,calign=fixed edge angles}
[\subnode{marka2}{a}
[b,edge=my dbl
[d]
]
[$\ast$
[d,edge=my dbl]
]
]
\end{forest}
\end{tabular}
\end{center}
\begin{tikzpicture}[overlay,remember picture]
\draw[dashed,-latex] (marka2) to[bend right] (marka1);
\end{tikzpicture}
\end{document}