2

Is there a way to obtain an arrow instead of a line connecting nodes in syntactic parse trees using forest? E.g. an arrow pointing from A to C in

enter image description here

\documentclass{minimal}
\usepackage{forest}
\forestset{
  nice nodes/.style={
   for tree={
   inner sep=0.25pt, s sep=5pt, 
   fit=band,
   },
   },
  default preamble=nice nodes,
   }

\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\begin{document}

\begin{forest}nice empty nodes, for tree={l sep=1em,l=0,calign angle=60}
[A [B] [C]]
\end{forest}

\end{document} 

I haven't found an obvious way to do it in the forest manual.

4

enter image description here

\documentclass[margin=3mm]{standalone}
\usepackage{forest}
\forestset{
  nice nodes/.style={
   for tree={
   inner sep=0.25pt,
   s sep=5pt,
   fit=band,
   edge={semithick, line cap=round, red!50}% <--- settings for all edges
   },
   },
  default preamble=nice nodes,
   }

\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}
\begin{document}
    \begin{forest}
    nice empty nodes,
    for tree={l sep=1em, l=0, calign angle=60}
[A [B] [C,edge+={->} % <--- this edges is arrow
        ]
]
    \end{forest}
\end{document}
| improve this answer | |
  • I need arrows to replace only specific lines in particular diagrams. Like I wrote in my question, only e.g. an arrow from A to C, not from A to B. -- I've now managed to do it for a particular nodes by adding edge={->} after the target node. Thanks! – oliver Apr 18 '18 at 22:32
  • 1
    @oliver, corrected. – Zarko Apr 18 '18 at 22:36
  • 1
    @cfr I don't seem to see a difference in the output... – oliver Apr 19 '18 at 0:02
  • 2
    @oliver Try adding edge={thick, blue} to the preamble of your tree and you'll see why adding is better. edge+ adds to the existing options, whereas edge replaces. Here, there are no other options specified for edges, so you'll see no difference, but if you later style the edges for the whole tree, you want the defaults to apply to the arrowed ones, too. – cfr Apr 19 '18 at 1:42
  • 1
    @oliver, what you means with "I'm marking this as solved"? if my answer solve your problem (on the best way) you can accept it :-) – Zarko Apr 19 '18 at 7:45

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.