修訂 | 1e89d4ab2882a7f758ded2ba15adc6ba17c5b53b (tree) |
---|---|
時間 | 2017-08-25 17:34:57 |
作者 | Lorenzo Isella <lorenzo.isella@gmai...> |
Commiter | Lorenzo Isella |
Another nice example of diagram using qtree and tikz.
@@ -0,0 +1,82 @@ | ||
1 | +\documentclass[]{article} | |
2 | +\usepackage[margin=1cm]{geometry} | |
3 | +\usepackage{tikz} | |
4 | +\usepackage{tikz-qtree} | |
5 | +\newcommand{\superscript}[1]{\ensuremath{^{\textrm{#1}}}} | |
6 | +\newcommand{\subscript}[1]{\ensuremath{_{\textrm{#1}}}} | |
7 | +\begin{document} | |
8 | + | |
9 | + | |
10 | +\tikzset{level 1/.style={level distance=20pt}} | |
11 | +\tikzset{level 2/.style={level distance=30pt}} | |
12 | +\tikzset{level 3+/.style={level distance=20pt}} | |
13 | +\tikzset{frontier/.style={distance from root=10\baselineskip}} | |
14 | +\begin{tikzpicture}[remember picture] | |
15 | +\Tree | |
16 | +[.{ST} | |
17 | + [.{NP} | |
18 | + [.NNP \node[](john){John}; ] | |
19 | + [.NNP \node[](smith){Smith}; ] ]%done | |
20 | + [.{VP} % level 2 VP contains VP1 CC VP2 | |
21 | + [.{VP\subscript{1}} | |
22 | + [.{VBD} \node[](walked){walked}; ] | |
23 | + [.{NP} | |
24 | + [.{PRP\$} \node[](his){his}; ] | |
25 | + [.{NN} \node[](dog){dog}; ] ] ] | |
26 | + [.{CC} \node[](and){and}; ] | |
27 | + [.{VP\subscript{2}} | |
28 | + [.ADVP | |
29 | + [.{RB} \node[] (afterwards) {afterwards}; ] ] | |
30 | + [.{VBD} \node[] (met) {Met}; ] | |
31 | + [.{NP} | |
32 | + [.{NNP} \node[] (mary) {Mary}; ] ] ] ] | |
33 | + [.{.} | |
34 | + [[[\node[](dot){.}; ] ] ] ] ] ] | |
35 | + | |
36 | +\begin{scope}[yshift=-9.5cm,xshift=-3cm,grow'=up] | |
37 | +\Tree | |
38 | +[.{ST} | |
39 | + [.{NP} | |
40 | + [.{NNP} \node[] (john2) {John}; ] | |
41 | + [.{NNP} \node[] (smith2) {Smith}; ]] | |
42 | + [.{VP} | |
43 | + [.{VBD} \node[] (walked2) {walked}; ] | |
44 | + [.{NP} | |
45 | + [.{PRP\$} \node[] (his2) {his}; ] | |
46 | + [.{NN} \node[] (dog2) {dog}; ] ]] | |
47 | + [.{.} | |
48 | + [[[[\node[] (dot2){.}; ]]]] ] ] | |
49 | +\end{scope} | |
50 | + | |
51 | +\begin{scope}[yshift=-9.5cm,xshift=3cm,grow'=up] | |
52 | +\Tree | |
53 | +[.{ST} | |
54 | + [.{NP} | |
55 | + [.{PRP} \node[] (he2) {He}; ] ] | |
56 | + [.{VP} | |
57 | + [.{VBD} \node[] (met2) {met}; ] | |
58 | + [.{NP} | |
59 | + [.{NNP} \node[] (mary2) {Mary}; ] ] | |
60 | + [.{ADVP} | |
61 | + [.{RB} \node[] (later2) {later}; ] ] ] | |
62 | + [.{.} | |
63 | + [[[[{.} ]]]] ] ] | |
64 | +\end{scope} | |
65 | + %draw the lines | |
66 | +\begin{scope}[remember picture, overlay] | |
67 | + \draw[black,dotted,thick](john) to (john2); | |
68 | + \draw[black,dotted,thick] (smith) to (smith2); | |
69 | + \draw[black,dotted,thick] (walked)to (walked2); | |
70 | + \draw[black,dotted,thick] (his) to (his2); | |
71 | + \draw[black,dotted,thick] (dog) to (dog2); | |
72 | + \draw[black,dotted,thick] (dot) to [out=220,in=50] (dot2); | |
73 | + \draw[black,dotted,thick] (met) to (met2); | |
74 | + \draw[black,dotted,thick] (mary) to (mary2); | |
75 | +\end{scope} | |
76 | +\end{tikzpicture} | |
77 | + | |
78 | + | |
79 | +\end{document} | |
80 | + | |
81 | + | |
82 | +\end{document} | |
\ No newline at end of file |