I know that syntax analysis can be done in Latex using using TikZ, but the tree-structure that produces isn't really used in my country. Here, we mostly use straight lines instead of hierarchy trees.
Here's an example what I want to achieve. I don't know where to start from.
Is there any (more or less) easy way to do it? Any idea?
Edit:
Even though all solutions provided until the moment are right, it would be nice to modify the following characteristics of the different diagrams you've proposed:
-
The sentence that is being analysed ("La novela que me ha regalado mi hermana…") should be on top of the graphic and all words must be in the same line; "la" can't be immediately over "Det" and "está" shouldn't be immediately over "N/V".
-
All the syntax functions of the differents words ("OP", "S/SN", "PN/SV", "Det"…) should be centered with the respective lines they have above (or at least near to the center but without having to change manually the spacing).
-
It should be possible to modify the height of the diagram.
Best Answer
Here’s a solution that uses the excellent
forest
package.And here’s another version with faint dotted edges:
You can render the same structure in a more conventional appearance just by changing options:
So you can see why one might prefer using
forest
instead ofbussproofs
orsemantics
. Also, theforest
tree syntax is much simpler, and is not “backwards” as seen in cfr’s answer.Take a look at the
forest
manual for more style options.2019 edit:
fit to tree
option syntax has been modified tofit to=tree
2020 edit: changing
l
asl=1.5em
changes the vertical spacing