2

I have the following code for a slide. I would like to draw a red ellipse around the arrow. I want to be it present on one overlay only to put the focus there during explanation.

enter image description here

\documentclass{beamer}

\usepackage{forest}
\useforestlibrary{linguistics}
\forestapplylibrarydefaults{linguistics}



\begin{document}

\frame{


\begin{forest}
[S
  [NP$_x$ [he,tier=words]]
  [VP x z y
    [V, [V x y,edge={<-},tier=words [baked]]]
    [NP$_z$ [her,tier=words]]
    [NP$_y$ [a cake,roof,tier=words]]]]
\end{forest}

}

\end{document}
Stefan Müller
  • 6,901
  • 3
  • 29
  • 61
  • 2
    It sounds more like you mean ellipse. If you really mean ellipsis, you might want to explain how that relates to around – Chris H Feb 23 '17 at 16:51
  • Ups, it is the same word in German. – Stefan Müller Feb 23 '17 at 17:11
  • Use fit with the tikz key or add the code directly. What's the problem exactly? What have you tried? – cfr Feb 23 '17 at 17:14
  • 1
    I found an explanation that helps me fit an ellipse around some nodes, but I do not want to include the nodes, just the arrow. – Stefan Müller Feb 23 '17 at 17:57
  • Ref to @StefanMüller. Replace V, with V,tikz={\node[inner sep=1pt,draw=blue,fit=()(!1),ellipse] {};}. But the ellipse is containing node V ()an its first child (!1). – Bobyandbob Feb 23 '17 at 18:13
  • 1
    Please ask one question per question. The overlay question is addressed elsewhere, so I suggest focusing on the ellipse issue here. If you can't solve the other part with the existing solutions, post a new question about that. (There is 'standard' Forest-specific code for doing this, adapted from the 'standard' TikZ code used for the same purpose.) – cfr Feb 23 '17 at 22:10

2 Answers2

5

Coordinates are just nodes with zero size, basically. At any rate, fit works as well with coordinates as nodes, so you can just use the relevant parent and child anchors.

ellipsed arrow

\documentclass[border=10pt]{standalone}
\usepackage[linguistics]{forest}
\usetikzlibrary{shapes.geometric,fit}
\begin{document}
\begin{forest}
  [S
    [NP$_x$
      [he,tier=words]
    ]
    [VP x z y
      [V,
        [V x y,edge={<-}, tier=words, tikz+={
          \node [fit=(.child anchor) (!u.parent anchor), draw, ellipse, inner ysep=1.5pt] {};
        }
          [baked]
        ]
      ]
      [NP$_z$
        [her,tier=words]
      ]
      [NP$_y$
        [a cake,roof,tier=words]
      ]
    ]
  ]
\end{forest}
\end{document}

If you need this often, you can, of course, create a style. I would also straighten out the edge on the right, which looks unhappy to me.

\documentclass[border=10pt]{standalone}
\usepackage[linguistics]{forest}
\usetikzlibrary{shapes.geometric,fit}
\forestset{%
  circle edge/.style={
    tikz+={
          \node [fit=(.child anchor) (!u.parent anchor), draw, ellipse, inner ysep=1.5pt] {};
        }
  },
}
\begin{document}
\begin{forest}
  [S
    [NP$_x$
      [he,tier=words]
    ]
    [VP x z y
      [V,
        [V x y,edge={<-}, tier=words, circle edge
          [baked]
        ]
      ]
      [NP$_z$, calign with current
        [her,tier=words]
      ]
      [NP$_y$
        [a cake,roof,tier=words]
      ]
    ]
  ]
\end{forest}
\end{document}

<code>circle edge</code> with straightened edge

cfr
  • 198,882
2

You can add,tikz={\node[inner sep=1pt,draw=blue,anchor=center,yshift=-2.93cm,xshift=-0.05cm,ellipse, minimum width=0.5cm, minimum height=0.8cm] {};} after the node V. Bad: explict shift to arrow necessary.

The size can be defined by minimum width=<length> and minimum height=<length>.

For line width you can use also thick, ultra thick,...

enter image description here

Code:

\documentclass{beamer}

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

\frame{


\begin{forest}
[S
  [NP$_x$ [he,tier=words]]
  [VP x z y
    [V,tikz={\node[inner sep=1pt,draw=blue,anchor=center,yshift=-2.93cm,xshift=-0.05cm,ellipse, minimum width=0.5cm, minimum height=0.8cm] {};} [V x y,edge={<-},tier=words [baked]]]
    [NP$_z$ [her,tier=words]]
    [NP$_y$ [a cake,roof,tier=words]]]]
\end{forest}

}

\end{document}
Bobyandbob
  • 4,899