-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtype-hierachies.tex
1917 lines (1672 loc) · 54.6 KB
/
type-hierachies.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[output=book
,modfonts
,nonflat
,collection
,collectionchapter
,collectiontoclongg
,biblatex
,babelshorthands
% ,showindex
,newtxmath
,colorlinks, citecolor=brown
,draftmode
% ,coverus
]{langscibook}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% put all additional commands you need in the
% following files. If you do not know what this might
% mean, you can safely ignore this section
\input{localmetadata.tex}
\input{localpackages.tex}
\input{localhyphenation.tex}
\input{localcommands.tex}
\renewcommand{\oneline}[1]{%
\begingroup
\sbox0{\ignorespaces#1\unskip}%
\noindent
\ifdim\wd0>\linewidth
\hbox to\linewidth{%
\hss\resizebox{\linewidth}{!}{\copy0 }\hss
}%
\else
\copy0 %
\fi
\endgroup
}
% just for this document:
\usepackage{shortvrb}
\MakeShortVerb{\|}
\newcommand\meta[1]{$\left<\text{#1}\right>$}
% udc stuff
% \newcommand{\tnode}[2]{
% \rnode{#1}{\emph{#2}}
% }
\newcommand{\bcdiag}[2]{
\ncdiag{#1}{#2}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Frontmatter %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\maketitle
\frontmatter
\currentpdfbookmark{Contents}{name} % adds a PDF bookmark
%%
\mainmatter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Chapters %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Uncomment the chapter(s) you would like to check
% \begin{forest}
% [{\footnotesize\textit{object}}
% [\{{\avmoptions{center}\begin{avm}\[\asort{substantive}
% prd & boolean\]\end{avm}}}
% [{{\avmoptions{center}\begin{avm}\[\asort{verb} vform & vform\\
% prd & plus\]\end{avm}}}]
% [{{\avmoptions{center}\begin{avm}\[\asort{noun} case & case\]\end{avm}}}] ]
% [{\footnotesize\textit{case}}]
% [{\footnotesize\textit{vform}}]
% [{\footnotesize\textit{boolean}}
% [{\footnotesize\textit{plus}}]
% [{\footnotesize\textit{minus}}] ]
% ]
% \end{forest}
% \bigskip
% \begin{forest}
% delay={for nodewalk={c2n,fake=n,tree}{content={\footnotesize\type{#1}}}},
% [object,
% calign=midpoint, calign children={2}{3},
% [{\[\asort{substantive} prd & boolean\]},avm=center
% [{\[\asort{verb} vform & vform\\prd & plus\]},avm=center]
% [{\[\asort{noun} case & case\]},avm=center]
% ]
% [case]
% [vform]
% [boolean
% [plus]
% [minus]
% ]
% ]
% \end{forest}
% \bigskip
\begin{forest}
type hierarchy
[electric appliance, calign=midpoint, calign children={1}{2},
[printing device,calign=first
[printer,calign=first
[laser printer]
[\ldots]]
[photocopier]]
[scanning device,calign=last
[,identify=!r12]
[scanner,calign=first
[negative scanner]
[\ldots]]]
[\ldots]]
\end{forest}
%\if0
\begin{forest} type hierarchy
[object,
calign=midpoint, calign children={2}{3},
[\avm{[\type*{substantive} prd & boolean]}
[\avm{[\type*{verb} vform & vform\\prd & plus]}]
[\avm{[\type*{noun} case & case]}]
]
[case]
[vform]
[boolean
[plus]
[minus]
]
]
\end{forest}
% Stefan: The AVMs should come out north and the atomic types (case, vform, \ldots) too. You did this in
% the second example. This is nice. Can this be done in the type hierarchy style?
% Sašo: In the second example, it only seems it works at first sight. In fact, the alignment is not
% perfect, and the problem is the AVMs. How are we on that front?
% Stefan: What does ``calign children'' do?
% Sašo: It sets ``calign primary child'' and ``calign secondary child'' at the same time.
% It is just a (new) shorthand for ``calign primary child=2, calign
% secondary child=3''.
% By default, "calign=center": the parent will be aligned with the
% midpoint between the primary and seconday child. But "calign=center" is
% an abbreviation for "calign=midpoint, calign primary child=1, calign
% secondary child=-1", so changing these children to 2 and 3 means that the
% alignment will be with the midpoint between these two children.
% If I remember correctly, I have used this in situations with ``...'' as
% the third child. Well, this effectively ignores the ``...'' for alignment
% with the parent.
% > I cannot find out what a secondary child is. This is in the manual on
% > page 40, but I am lacking something. It is not the second child, right?
% > But then what is the function of this concept?
% Different methods of "calign" use the settings given in "calign primary
% child" and "calign secondary child". Some use only the former, some
% both. If you remember, I also introduced a shortcut "calign children" to
% set both at once.
>
> What I try to find out now, is how do I get common-noun exactly aligned
> with noun and verb aligned with relational:
This is really easy now (in your, pre-published version of forest), just
say ``calign=2'' in both ``noun'' and ``relational'' nodes.
In the CTAN version, you can say ``calign with current'' on ``common-noun''
and ``verb''. (This works in your version as well, of course.)
What both of these approaches do, under the hood, is set (on the parent
node) ``calign=child'' and ``calign primary child=2''. (``calign secondary
child'' not used by ``calign=child'' method.)
% New AVM package:\\
% \begin{forest} type hierarchy
% [object,
% calign=midpoint, calign children={2}{3},
% [\avmtmp{[\type*{substantive}
% prd & boolean]}
% [\avmtmp{[\type*{verb}
% vform & vform\\
% prd & plus]}]
% [\avmtmp{[\type*{noun}
% case & case]}]
% ]
% [case]
% [vform]
% [boolean
% [plus]
% [minus]
% ]
% ]
% \end{forest}
\newpage
\begin{forest}
[{\footnotesize\textit{list}}
[{\avm{[\type*{nelist} first & object\\
rest & list]}}]
[{\footnotesize\textit{elist}} ]]
\end{forest}
\bigskip
\begin{forest} type hierarchy
[list
[\avm{[\type*{nelist} first & object\\rest & list]}]
[elist]
]
\end{forest}
Stefan: Both AVMs and types should come out north.
Sašo: ditto.
\newpage
\oneline{%
\begin{forest}
[{\type{univ-pas-bas-lci}}
[{\type{univ-do-pas-lci}}, name=D
[{\type{german-zuinf-pas-lci}}, name=Z
[{\type{german-pers-zuinf-pas-lci}}
[{\type{german-long-pers-neutral-zuinf-pas-lci}}, name=PZ
[{\type{german-long-pers-zuinf-pas-lci}} ]
[{\type{german-long-attr-zuinf-pas-lci}} ]
]
]
]
]
[{\type{german-pas-lci}}, name=G
[ , no edge ]
[{\type{german-long-pas-lci}}, name=L
[ , no edge ] ]
[{\type{german-io-pas-lci}} ]
]
[ {\type{univ-imp-pas-lci}} ]
[ {\ldots} ]
]
\draw(G.south) -- (Z.north);
\draw(L.south) -- (PZ.north);
\end{forest}}
\bigskip
\oneline{%
\begin{forest} type hierarchy
[univ-pas-bas-lci
[univ-do-pas-lci
[german-zuinf-pas-lci, edge to=!un
[german-pers-zuinf-pas-lci
[german-long-pers-neutral-zuinf-pas-lci, edge to=!r21,
calign=first % maybe?
[german-long-pers-zuinf-pas-lci ]
[german-long-attr-zuinf-pas-lci ]
]
]
]
]
[german-pas-lci, calign with current, calign=first
[german-long-pas-lci]
[german-io-pas-lci ]
]
[ univ-imp-pas-lci ]
[ \ldots, fit=band % maybe?
]
]
\end{forest}%
}
Stefan: Do you know what one can do about the black bars? The figure is scaled
to fit the linewidth, so there should not be any black bars.
Sašo: well, they will be gone once the draft mode is off, but I know what you mean \dots\@ So I replaced
|\leavevmode| in the definition of |\oneline| for |\noindent|.
\bigskip
\newpage
%\oneline{%
\begin{forest} type hierarchy
[univ-pas-bas-lci
[univ-do-pas-lci
[german-zuinf-pas-lci, edge to=!un
[german-pers-zuinf-pas-lci]
]
]
[german-pas-lci, calign with current, calign=first
[german-long-pas-lci
[german-long-pers-neutral-zuinf-pas-lci, l*=2, edge to=!r111,
[german-long-pers-zuinf-pas-lci ]
[german-long-attr-zuinf-pas-lci ]
]
]
[german-io-pas-lci ]
]
[ univ-imp-pas-lci ]
[ \ldots, fit=band % maybe?
]
]
\end{forest}
%}
Stefan: Very nice. See my comments in the code. Did I get these right?
Sašo: Yes!
\begin{forest}
type hierarchy
[univ-pas-bas-lci
[univ-do-pas-lci
[german-zuinf-pas-lci, edge to=!un % draw an edge to the "uncle": !un = first go "u"p, then to
% the "n"ext node = german-pas-lci ("!" means we will not
% give a node name but a nodewalk)
[german-pers-zuinf-pas-lci]
]
]
[german-pas-lci, calign with current,
calign=first % the center of the children is exactly below german-pas-lci
% this is so since we have two daughters in the tree,
% but three in the hierarchy. There will be a further edge
% from german-zuinf-pas-lci.
[german-long-pas-lci
[german-long-pers-neutral-zuinf-pas-lci, l*=2, edge to=!r111, % draw an edge to the node (!r111),
% which is found by going to the first child of the root node (!r1)
% = univ-do-pas-lci and the first child of this node (!r11) =
% german-zuinf-pas-lci and the first child of this node (!r111) = german-pers-zuinf-pas-lci
[german-long-pers-zuinf-pas-lci ]
[german-long-attr-zuinf-pas-lci ]
]
]
[german-io-pas-lci ]
]
[ univ-imp-pas-lci ]
[ \ldots, fit=band
]
]
\end{forest}
Stefan: It works even without ``calign with current'', doesn't it?
Sašo: No, because of the dots on the right.
\newpage
\begin{forest}
[{\type{head}}
[{\type{func}} [{\type{det}} ] [{\type{marker}} ] ]
[{\type{subst}} [{\type{noun}}
[{\type{c-noun}} ] [{\type{gerund}}, name=G ]
]
[{\type{relational}}, name=R
[, no edge ]
[{\type{verb}} ] [{\type{adj}} ] [{\type{prep}} ]
] ]
]
\draw(R.south) -- (G.north);
\end{forest}
\bigskip
\begin{forest}
type hierarchy
[head
[func
[det]
[marker]
]
[subst
[noun
[c-noun]
[gerund, edge to=!un] % draw an edge to the node one up (u) and the next sibling (n), which
% is "relational"
]
[relational, calign children={1}{2}
[verb]
[adj]
[prep]
]
]
]
\end{forest}
Stefan: What does ``calign children'' do? ``identify'' seems to be even better here:
Sašo: The result is different, so it's up to you what you prefer. |calign children| does nothing but set
the children which the default calign method |midpoint| will work with. This is why above, ``verb'' and
``adj'' are symmetric --- child alignment is to their midpoint. And what happens below, with |identify|?
a) With |identify|, we pretend that ``gerund'' is a child of ``relational''. So we have four children.
The default calign method, |midpoint| is again in effect, but by default it works on the first and the
last child, so it is now ``gerund'' and ``prep'' which are symmetric. (In other words, this is normal
centering.)
\begin{forest}
type hierarchy
[head
[func
[det]
[marker]
]
[subst
[noun
[c-noun]
[gerund]
]
[relational,
[,identify=!P] % The previous leaf is identical.
[verb]
[adj]
[prep]
]
]
]
\end{forest}
How does |identify| work? We have two nodes: the ``identified'' node where we apply this key, and the
``other'' node that we point to when we say |identify=|\meta{relative node name}.
So what happens? We copy the content of the other node into the identified node (that's why it makes no
sense to have content in the identified node) and phantomize it. When forest is doing its job
(arranging the nodes so that they fit together nicely --- this is called packing), the parent of our
identified node (``relational'') really has four children: the invisible ``gerund'', and visible
``verb'', ``adj'' and ``prep''. But after packing these four children under ``relational'' (normally,
and this is why ``gerund'' looks like a normal child of ``relational''), we make it ``forget'' about
the invisible ``gerund'' completely (we |ignore| it, plus do some black magic to forget about any
descendants it might have). So, when it comes to packing the children of ``subst'', the phantom
``gerund'' is completely ignored, and forest is really putting together ``[noun[c-noun][gerund]]'' and
``[relational[verb][adj][prep]]''.
Effectively, we get a child which is ``shared'' between two parents. Crucially, during packing
(including positioning according to |calign|), the shared child was taken into account for both parents.
Note that if we want uniform distances between ``c-noun'' \dots ``prep'', three |s sep|s must be equal:
of nodes ``noun'', ``relational'' and also ``subst''.
\newpage
\begin{forest}
[{\type{verb}}
[{\fbox{\textsc{vform}}}
[{\type{fin}}, name=A1
[{\tc{gray}{\type{fin+intrans}}}, name=A,edge={gray,dashed} ]
[, no edge ] ]
[{\type{base}}, name=B1 [{\tc{gray}{\type{base+trans}}}, name=B,
edge={gray,dashed} ]
[, no edge ] ]
]
[{\fbox{\textsc{arg-st}}}
[{\type{intrans}}, name=C1
[, no edge ]
[{\tc{gray}{\type{base+intrans}}}, name=C,edge={gray,dashed} ] ]
[{\type{trans}}, name=D1
[, no edge ]
[{\tc{gray}{\type{fin+trans}}}, name=D,edge={gray,dashed} ] ]
]
]
\draw[style=dashed,gray] (C1.south) -- (A.north);
\draw[style=dashed,gray] (D1.south)-- (B.north);
\draw[style=dashed,gray] (B1.south)-- (C.north);
\draw[style=dashed,gray] (A1.south)-- (D.north);
\end{forest}
\bigskip
\begin{forest}
type hierarchy,
%for level=2{tier=2},
for level=3{l*=1.5,gray,edge={gray,dashed}},
[verb
[\textsc{vform},draw,
before computing xy={for relative level=2{s-=3em}},
[fin, name=A1
[fin+intrans, name=A, edge to=!r21]
]
[base, name=B1
[base+trans, name=B, edge to=!r22]
]
]
[\textsc{arg-st},draw,
before computing xy={for relative level=2{s+=3em}},
[intrans, name=C1
[base+intrans, name=C, edge to=!r12]
]
[trans, name=D1
[fin+trans, name=D, edge to=!r11]
]
]
]
\end{forest}
\bigskip
\forestset{
textsc/.style={
% People usually say "delay={ content=\textsc{#1} }" but I don't like that. First, out of principle,
% as the form and content are not separated ;-) but sometimes there's also a practical reason.
% Assume you want to detect empty nodes (we do this often to turn them into coordinates). Well, if
% you say "content=\textsc{#1}", then the node is not empty anymore. So, I prefer "content format".
content format={\textsc{\forestoption{content}}},
draw,
outer ysep=0.5ex, % outer sep (tikz) means how much a node is padded outside the border.
},
}
\begin{forest}
type hierarchy,
% for level=2{tier=2},
for level=3{l*=1.5,gray,edge={gray,dashed}},
[verb
[vform, textsc,
[fin, name=A1
[fin+intrans, name=A, edge to=!r21,
before drawing tree={
for nodewalk={cNNN}{x-=3em},
spread=x{cNNN}{!r22}{3em},
},
]
]
[base, name=B1
[base+trans, name=B, edge to=!r22]
]
]
[arg-st, textsc,
[intrans, name=C1
[base+intrans, name=C, edge to=!r12]
]
[trans, name=D1
[fin+trans, name=D, edge to=!r11]
]
]
]
\end{forest}
Stefan: Wow! Could you explain why tier=2 is needed?
Sašo: Umm ... it is not.
Stefan: What does the ``before drawing tree'' magic do?
Sašo: The idea in the final tree is to have the bottom nodes uniformly distanced from one another (note
that this is not the case in the second tree). So we let forest position the bottom nodes directly
under their parents and then spread them out using |spread| (we define this in langsci-forest-setup).
But the point here is that we can only reposition the nodes once when are positioned. So here's a crash
course on forest \emph{stages} (manual 3.4.1).
Forest first reads in the input (simplifying a lot here), then enters |typeset nodes stage| where each
node is typeset in limbo and measured. Then comes the stage that forest was made for: |pack stage|
nicely and tightly positions the nodes. In detail, this determines the so-called |l| (level) and |s|
(sibling) coordinates of nodes --- |l| and |s| are relative to the parent; |l| axis is in the direction
of tree growth, here down; |s| is orthogonal to it. But before we can think of finally putting the tree
on paper, we must compute the |x| and |y| coordinates of nodes: this is done in |compute xy stage|. Only
then, forest enters |draw tree stage|.
Now above, we want to adjust the |x| coordinate of some nodes. Clearly, we have to do this after |x| (and
|y|) were computed. And also clearly, before the tree is drawn. So |before drawing tree|.
Stefan: The lines should not touch the boxes as with the type in other trees.
Sašo: Ah! Well, then use either the original |\fbox| idea, or if you need more flexibility (in the first
tree, there is actually too much space above the box for my taste), I made an |textsc| style where you
can set the exact amount of spacing. Look at the third tree.
I introduced the styles ``,partition'' and ``,instance'' for the boxed and the grey nodes. This is
really cool! Thanks! Here is my version:
% how to: just draw the tree without multiple inheritance.
% every type will have exactly one subtype
% fin+intrans is a subtype of fin, we need another edge to intrans, which is drawn by "edge to" with
% the node specifeid by a path starting at the root node (r). We go to the second daughter of the
% root node, which is ARG-ST (!r2) and take the first duaghter of it, which is intr (!r21).
% magic code
%
% before drawing tree={
% for nodewalk={cNNN}{x-=3em},
% spread=x{cNNN}{!r22}{3em},
% },
%
% is added to spread the last line by ...
\begin{forest}
type hierarchy, instances,
% for level=2{tier=2},
for level=3{l*=1.5}, % increases the distance to the third level (the instances) by a factor of 1.5
[verb
[vform,partition,
[fin,
[fin+intrans, edge to=!r21,
before drawing tree={
for nodewalk={cNNN}{x-=3em},
spread=x{cNNN}{!r22}{3em},
},
]
]
[base,
[base+trans, edge to=!r22]
]
]
[arg-st,partition,
[intrans,
[base+intrans, edge to=!r12]
]
[trans,
[fin+trans, edge to=!r11]
]
]
]
\end{forest}
\newpage
\oneline{%
\begin{forest}
for tree={inner sep=-1pt,l=50pt}
[{\type{aller}}
[{\fbox{\type{aller-entries}}}
[{\type{``fit}}, name=F
[{\tc{gray}{\type{``fit''+all-}}}, name=F1,edge={dashed,gray},tier=bottom ]
[{\tc{gray}{\type{``fit''+v-}}}, name=F2,edge={dashed,gray},tier=bottom ]
[, no edge ]
[, no edge ] ]
[{\type{``go''}}
[{\type{``go.to''}}, name=G
[{\tc{gray}{\type{``go.to''+all-}}}, name=G1, edge={dashed,gray} ]
[{\tc{gray}{\type{``go.to''+v-}}}, name=G2, edge={dashed,gray} ]
[, no edge ]
[, no edge ] ]
[{\type{``leave''}}, name=L, for tree={l=100pt}
[{\tc{gray}{\type{``leave''+all-}}}, name=L1,edge={dashed,gray} ]
[{\tc{gray}{\type{``leave''+v-}}}, name=L2,edge={dashed,gray} ]
[, no edge ]
[, no edge ]
] ]
]
[{\fbox{\type{aller-stems}}}, for tree={l=100pt,inner sep=-3pt}
[{\type{all-}}, name=A
[, no edge ]
[, no edge ]
[, no edge ]
]
[{\type{v-}}, name=V
[, no edge ]
[, no edge ]
[, no edge ]
]
[{\type{i-}}, name=I, for tree={l=80pt}
[{\tc{gray}{\type{``fit''+i-}}}, name=I1,edge={dashed,gray} ]
[{\tc{gray}{\type{``go.to''+i-}}}, name=I2,edge={dashed,gray} ]
[{\tc{gray}{\type{``leave''+i-}}}, name=I3,edge={dashed,gray} ]
]
[{\type{aill-}}, name=AI, for tree={l=100pt,inner sep=-3pt}
[{\tc{gray}{\type{``fit''+aill-}}}, name=A1, edge={dashed,gray} ]
[{\tc{gray}{\type{``go.to''+aill-}}}, name=A2, edge={dashed,gray} ]
[{\tc{gray}{\type{``leave''+aill-}}}, name=A3, edge={dashed,gray},tier=bottom ]
]
]
]
\draw[style=dashed,gray](A.south) -- (F1.north);
\draw[style=dashed,gray](V.south) -- (F2.north);
\draw[style=dashed,gray](A.south) -- (G1.north);
\draw[style=dashed,gray](V.south) -- (G2.north);
\draw[style=dashed,gray](A.south) -- (L1.north);
\draw[style=dashed,gray](V.south) -- (L2.north);
\draw[style=dashed,gray](F.south) -- (I1.north);
\draw[style=dashed,gray](F.south) -- (A1.north);
\draw[style=dashed,gray](G.south) -- (I2.north);
\draw[style=dashed,gray](G.south) -- (A2.north);
\draw[style=dashed,gray](L.south) -- (I3.north);
\draw[style=dashed,gray](L.south) -- (A3.north);
\end{forest}}
\bigskip
%\oneline{%
\begin{forest}
type hierarchy,
for tree={
s sep=0,
if n children=0{
gray,
edge={dashed,gray},
}{},
},
[aller
[aller-entries,draw
[``fit'', name=F, l*=4, for children={l*=2},
[``fit''+all-, edge to=A]
[``fit''+v-, edge to=V]
]
[``go''
[``go.to'', name=G, l*=2, for children={l*=4},
[``go.to''+all-, edge to=A, ignore edge]
[,coordinate,edge'={}]
[``go.to''+v-, edge to=V]
]
[``leave'', name=L, for children={l*=6},
[``leave''+all-, edge to=A, ignore edge]
[,coordinate,edge'={}]
[``leave''+v-, edge to=V,ignore edge]
]
]
]
[aller-stems, calign children=34, draw, where n children=0{l*=4.5}{},
[all-, name=A, before computing xy={s-=3em} [,phantom,ignore,ignore edge]]
[v-, name=V, before computing xy={s-=1.5em} [,phantom,ignore,ignore edge]]
[i-, name=I, l*=2,
[``fit''+i-, edge to=F]
[``go.to''+i-, edge to=G, ignore edge]
[``leave''+i-, edge to=L, ignore edge]
]
[aill-, name=AI,
[``fit''+aill-, edge to=F]
[``go.to''+aill-, edge to=G]
[``leave''+aill-, edge to=L]
]
]
]
\end{forest}
%}
Stefan: Here I would prefer if the dashed lines would not cross any black nodes. So edges from ``all-''
should not cross ``leave''. I guess this could be reached by shifting ``all-'' to the right or
putting it on the same line as ``leave''. But I do not understand the code. Maybe there are better
ways.
Sašo: Yes, I didn't know how much it would bother you. Personally, I dislike resized (shrunk) figures.
What I did now is a) Moved ``all-'' to the right and then, to avoid overfull box or shrinking, b) reduce
the horizontal spacing between nodes. But if they are too close now, we search for another solution.
\begin{forest}
type hierarchy,
instances,
for tree={
% reduce horizontal spacing
inner xsep=0, % in comparison to s sep=0, this makes the left- and right-most node touch the
% margins of the page precisely
s sep=0.275em,
},
[aller, s sep=3em, % push "all-" a bit to the right, so that dashed edges avoid "leave"
[aller-entries, partition
[``fit'', name=F, l*=4, for children={l*=2}, % "l*=<n>" pushes the node <n> 'levels' down.
[``fit''+all-, edge to=A] % "edge to" can also take a node name, that's why there is no "!"
[``fit''+v-, edge to=V]
]
[``go''
[``go.to'', name=G, l*=2, for children={l*=4},
[``go.to''+all-, edge to=A, ignore edge] % if there was no "ignore edge", "fit" and children
% would be pushed more to the left
[,coordinate,edge'={}]
[``go.to''+v-, edge to=V]
]
[``leave'', name=L, for children={l*=6},
[``leave''+all-, edge to=A, ignore edge] % if there was no "ignore edge", "go.to" and
% children would be pushed more to the left
[,coordinate,edge'={}]
[``leave''+v-, edge to=V,ignore edge] % if there was no "ignore edge", "i-" and children
% would be pushed more to the right
]
]
]
[aller-stems, partition,
calign children=34, % align to the midpoint between the third and the fourh child
% "calign children={3}{4}" would be more understandable, right? ;-)
where n children=0{l*=4.5}{}, % push all the leaves of "aller-stems" 4.5 levels down
% Forest does a bad job nicely positioning the children of "aller-stems", because we have pushed
% "i-" down. "all-" and "v-" end up too close to "i-" and each other, so we push them to the
% left by "before computing xy={s-=...}". (I explained "before computing xy" somewhere above.)
%
% The weird "[,phantom,red,ignore,ignore edge]" children have a single function: "all-" and "v-"
% should not be leaves of the tree, because of "instances" at the top and "where n
% children=0{l*=4.5}{}" above. So we give them a child which is both invisible and completely
% ignored in packing. :D
[all-, name=A, before computing xy={s-=3em} [,phantom,red,ignore,ignore edge]]
[v-, name=V, before computing xy={s-=1.5em} [,phantom,red,ignore,ignore edge]]
[i-, name=I, l*=2,
[``fit''+i-, edge to=F]
[``go.to''+i-, edge to=G, ignore edge]
[``leave''+i-, edge to=L, ignore edge]
]
[aill-, name=AI,
[``fit''+aill-, edge to=F]
[``go.to''+aill-, edge to=G]
[``leave''+aill-, edge to=L]
]
]
]
\end{forest}
Stefan: The n children=0 stuff is cool. I turned this into a style. =:-)
Saso: :-)
\newpage
\hspace*{-1em}\begin{tikzpicture}[text height=1.5ex,text depth=.25ex,
% inner sep=2pt,
node distance=5em,
baseline=10.75em]\small\it
\node (snom) {snom};
\node (sgen) [right of=snom] {sgen};
\node (sacc) [right of=sgen] {sacc};
\node (lgen) [right of=sacc] {lgen};
\node (ldat) [right of=lgen] {ldat};
\node (lacc) [right of=ldat] {lacc};
\node (acc) [above of=sacc] {acc};
\node (dat) [left of=acc] {dat};
\node (gen) [left of=dat] {gen};
\node (nom) [left of=gen] {nom};
\node (structural) [above of=lgen, xshift=3em] {structural};
\node (lexical) [above of=lacc] {lexical};
\node (morph-case) [above right of=gen] {morph-case};
\node (syn-case) [above right of=structural] {syn-case};
\node (case) [above of=acc, node distance=7em] {case};
\draw (case.south) -- (morph-case.north);
\draw (case.south) -- (syn-case.north);
\draw (morph-case.south) -- (nom.north);
\draw (morph-case.south) -- (gen.north);
\draw (morph-case.south) -- (dat.north);
\draw (morph-case.south) -- (acc.north);
\draw (syn-case.south) -- (structural.north);
\draw (syn-case.south) -- (lexical.north);
\draw (nom.south) -- (snom.north);
\draw (gen.south) -- (sgen.north);
\draw (gen.south) -- (lgen.north);
\draw (dat.south) -- (ldat.north);
\draw (acc.south) -- (sacc.north);
\draw (acc.south) -- (lacc.north);
\draw (structural.south) -- (snom.north);
\draw (structural.south) -- (sgen.north);
\draw (structural.south) -- (sacc.north);
\draw (lexical.south) -- (lgen.north);
\draw (lexical.south) -- (ldat.north);
\draw (lexical.south) -- (lacc.north);
\end{tikzpicture}
\bigskip
\begin{forest}
type hierarchy,
[case
[morph-case, name=M
[nom]
[gen]
[dat]
[acc]
]
[syn-case
[structural]
[lexical, calign=last, % We just make all the cases subtypes of "lexical", even the structural
% ones and align the last child to "lexical". It will be right below "lexical".
l sep*=3, % The distance between "lexical" and the nodes below it is multiplied
% by three.
[snom, edge to=!up, % There is an edge to the previous node (p) of the node up (u) (!pu) = "structural"
edge to=M!1, % There is an edge to the first child of M (M!1) = "morph-case".
no edge] % and there is no edge to the original mother.
[sgen, edge to=!up, edge to=M!2, no edge ]
[sacc, edge to=!up, edge to=M!4, no edge ]
[lgen, edge to=M!2 ]
[ldat, edge to=M!3 ]
[lacc, edge to=M!4,
before drawing tree={
spread=x{current and preceding siblings reversed}{M!1}{0}
},
]
]
]
]
\end{forest}
Stefan: What does the magic code ``before drawing tree'' do?
Sašo: explained above.
\newpage
\begin{tikzpicture}[text height=1.5ex,text depth=.25ex,
% inner sep=2pt,
node distance=3em,
baseline=5.25em]\small\it
\node (p-acc) {p-acc};
\node (p-acc1) [right of=p-acc] {};
\node (p-nom-acc) [right of=p-acc1] {p-nom-acc};
\node (p-nom1) [right of=p-nom-acc] {};
\node (p-nom) [right of=p-nom1] {p-nom};
\node (acc) [above of=p-acc1] {acc};
\node (nom) [above of=p-nom1] {nom};
\node (p-nom-acc1) [above of=p-nom-acc] {};
\node (case) [above of=p-nom-acc1] {case};
\draw (case.south) -- (acc.north);
\draw (case.south) -- (nom.north);
\draw (acc.south) -- (p-acc.north);
\draw (acc.south) -- (p-nom-acc.north);
\draw (nom.south) -- (p-nom.north);
\draw (nom.south) -- (p-nom-acc.north);
\end{tikzpicture}
\bigskip
\begin{forest}
type hierarchy,
[case
[acc
[p-acc]
[p-nom-acc]
]
[nom
[,identify=!P] % The previous leaf is identical.
[p-nom]
]
]
\end{forest}
\newpage
\begin{tikzpicture}[text height=1.5ex,text depth=.25ex,
% inner sep=2pt,
node distance=4em,
baseline=5.25em]\small\it
\node (p-acc) {p-acc};
\node (p-acc1) [right of=p-acc] {};
\node (p-nom-acc) [right of=p-acc1] {p-nom-acc};
\node (p-nom1) [right of=p-nom-acc] {};
\node (p-nom) [right of=p-nom1] {p-nom};
\node (acc) [above of=p-acc1, node distance=3em, xshift=-1em] {acc};
\node (nom) [above of=p-nom1, node distance=3em, xshift=1em] {nom};
\node (p-nom+acc) [above of=p-nom-acc, node distance=3em] {p-nom+acc};
\node (nom+acc) [above of=p-nom+acc, node distance=3em] {nom+acc};
\draw (nom+acc.south) -- (acc.north);
\draw (nom+acc.south) -- (nom.north);
\draw (nom+acc.south) -- (p-nom+acc.north);
\draw (acc.south) -- (p-acc.north);
\draw (acc.south) -- (p-nom-acc.north);
\draw (nom.south) -- (p-nom.north);
\draw (nom.south) -- (p-nom-acc.north);
\end{tikzpicture}
\bigskip
\begin{forest}
type hierarchy,
[case,
[acc
[p-acc]
[,identify=!N] % Identify this node with the next leaf = p-nom-acc.
]
[p-nom+acc, calign with current % Align this node with its mother (case).
[p-nom-acc, % p-nom-acc is a fake daughter of p-nom+acc.
delay=no edge
]
]
[nom
[,identify=!P] % Identify this node with the previous leaf = p-nom-acc.
[p-nom]
]
]
\end{forest}
Stefan: What does the ``delay'' do? Is it the case that without the ``delay'', ``identify'' would not
know that p-nom-acc is a leaf?