1

How do i add the dash line between two tree as in image below,

enter image description here

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

This is my current code so far. Nothing is working.

  • tikzmark library might help – def Apr 18 at 13:57
1

As explained in this answer, you can use \subnodes, which are anyway already present (but commented out) in your code.

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.