4

this is my first question here (so I apologize hereby for any formatting/formulating error).

My textbook in Lexical-Functional Grammar (P.R. Kroeger's "Analyzing Syntax") does f-structures in quite a different way from every other work I've read. This is a picture from the book:

My professor wants us to follow this model, and we haven't been taught in using "normal" graphs (then one with the big square brackets, than many smaller square brackets inside). Does anybody have an idea of how i can achieve a graph like this? I've tryed googling, but haven't come to a lot of results. I'd appreciate any help! Thanks

7

Here’s an attempt based somewhat on the examples in §4 of the forest manual.

One advantage of a forest solution is to easily swap between tree styles, e.g. a more conventional appearance with straight edges, or even something upside-down.

\documentclass{article}
\usepackage{forest}
\begin{document}

\begin{forest}
for tree={
  s sep=1.5em,
  l sep=5em,
  text depth=0.5em,
  text height=1em,
  font=\itshape,
  parent anchor=south,
  child anchor=north,

  % for the empty nodes
  delay={where content={}{shape=coordinate,for parent={for children={anchor=north}}}{}},

  % for the curved edges
  edge path={
    \noexpand\path[\forestoption{edge}]
    (\forestOve{\forestove{@parent}}{name}.parent anchor)
    .. controls +(0,0) and +(0,5em) .. % same as l sep
    \forestoption{edge label}
    (\forestove{name}.child anchor);
  }
},

foo/.style n args=3{edge label={node[pos=0.8, font=\scshape, auto=#1, anchor=#2]{#3}}},
ll/.style={foo={left}{east}{#1}},
lr/.style={foo={right}{west}{#1}},

[
    [persuade,ll=pred]
    [John,ll=subj]
    [Mary,lr=obj,for tree={l sep-=1em}
        [,name=a]
    ]
    [,lr=xcomp,s sep=2.5em % add fit=band if you want even more space
        [behave,ll=pred]
        [,ll=subj,tikz={\draw () to[out=270,in=270] (a);}]
        [herself,lr=obj]        
    ]
]
\end{forest}
\end{document}

  • @GonzaloMedina Thanks! I’m not too happy with all of my solution though. For example, the 5em in the controls is hard-coded to be the same as the l sep value, the lopsided U-shaped curve drawn between empty nodes, etc. – hftf Sep 26 '15 at 3:07
  • Although details are also important, I appreciate here the general idea. – Gonzalo Medina Sep 26 '15 at 4:05
4

Here is an attempt using the default TikZ trees. Although I actually prefer the syntax of forest (which also does some things better than TikZ on its own) I couldn't get the arc down to to work in forest without drowning in an ugly sea of \noexpand. The "magic" number .551 is truncated from the paper by Aleksas Riškus on approximating arcs with Bézier curves.

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{calc,quotes}
\begin{document}
\begin{tikzpicture}[every child node/.style={font=\itshape, anchor=base},
  every child/.style={path label=},
  arc down to/.style={to path={
    let \p1=(\tikztostart),\p2=(\tikztotarget),
\n1={(\x2-\x1)*0.551}, \n2={(\y1-\y2)*0.551} in
  (\p1) .. controls +(\n1,0) and +(0,\n2) ..  (\p2) \tikztonodes
  }},
  edge from parent path={
(\tikzparentnode.south) edge [arc edge node/.try, arc down to]
 (\tikzchildnode.north) 
},
semicircle under to/.style={to path={
   let \p1=(\tikztostart),\p2=(\tikztotarget) 
    in  arc (180:360:\x2/2-\x1/2)
}},
path label/.style={arc edge node/.style={#1}},
level distance=0.75in,
sibling distance=0.75in,
level 2/.style={sibling distance=0.625in}]

\node [coordinate] {}
  child [path label="PRED"'] { node {persuade} }
  child [path label="SUBJ"' near end] { node {John}  }
  child [path label="OBJ"' near end] { node (mary) {Mary} }
  child [path label="XCOMP", sibling distance=1in] { 
    node [coordinate] (x) {} 
      child [path label="PRED"' near end] { node {behave} }
      child [path label="SUBJ"' near end] { node [coordinate] (subj) {} }
      child [path label="OBJ"] { node {herself} }
  };

\draw (mary.south) -- (mary.south |- subj) to [semicircle under to] (subj);
\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.