我必须绘制下图。我现在画的图很丑。不知何故,结构应该更平衡。有没有办法用 tikz-qtree 做到这一点?关键是它是多重支配的,而且节点标签不在树内,而是在树旁边。顶部节点没有标签。
\documentclass{minimal}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(0,0)(10,10)
\rput[B](1,0){German}
\rput[B](3,0){Dutch}
\rput[B](5,0){Danish}
\rput[B](7,0){English}
\rput[B](9,0){French}
\rput[B](1.5,2){SOV}
\rput[B](1.5,1.6){VC}
\rput[B](3,4){V2}
\rput[B](7.7,2){SVO}
\psline(1,0.4)(4,5)
\psline(2,2)(3,0.4)
\psline(3.4,4)(5,0.4)
\psline(5,0.4)(7,2)
\psline(7,2)(7,0.4)
\psline(4,5)(9,0.4)
%\psgrid
\end{pspicture}
\end{document}
答案1
这是一种使用可能性TikZ
;我使用了该trees
库(尽管从形式上讲,这不是一棵树):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\begin{tikzpicture}[
level 1/.style={sibling distance=60pt},
level 3/.style={sibling distance=40pt}
]
\coordinate
child {node (v2) {V2}
child {node[text width=2.2em,align=center] {SOV\\VC}
child {node {German}}
child {node {Dutch}}}
child[missing]
}
child {
child[missing]
child {node {SVO}
child {node (dan) {Danish}}
child {node {English}}
child {node {French}}}
};
\draw (v2) -- (dan);
\end{tikzpicture}
\end{document}
答案2
最好的方法是使用像 Gonzalo 这样的库树,但下面我给出了 tikz 中代码的翻译,以及一些不使用树而只使用 tikz 的可能性。最后一个代码是更好的尝试。
\begin{tikzpicture}
\node[anchor=base] at (1,0) {German};
\node[anchor=base] at (3,0) {Dutch};
\node[anchor=base] at (5,0) {Danish};
\node[anchor=base] at (7,0) {English};
\node[anchor=base] at (9,0) {French};
\node[anchor=base] at (1.5,2) {SOV};
\node[anchor=base] at (1.5,1.6) {VC};
\node[anchor=base] at (3,4) {V2};
\node[anchor=base] at (7.7,2) {SVO};
\draw (1,0.4) -- (4,5);
\draw (2,2) -- (3,0.4);
\draw (3.4,4) -- (5,0.4);
\draw (5,0.4) -- (7,2);
\draw (7,2) -- (7,0.4);
\draw (4,5) -- (9,0.4);
\end{tikzpicture}
最后的代码最好是这样的:
\begin{tikzpicture}[every node/.style={anchor=base}]
\path
(1,0) node {German} (3,0) node {Dutch}
(5,0) node {Danish} (7,0) node {English}
(9,0) node {French} (1.5,2) node {SOV}
(1.5,1.6) node {VC} (3,4) node {V2}
(7.7,2) node {SVO};
\draw (1,0.4) -- (4,5) (2,2) -- (3,0.4) (3.4,4) -- (5,0.4)
(5,0.4) -- (7,2) (7,2) -- (7,0.4) (4,5) -- (9,0.4);
\end{tikzpicture}
我们可以得到类似 Gonzalo 的东西:
\begin{tikzpicture}[every node/.style={anchor=base}]
\path
(4,5) coordinate (main)
(1,0) node (G) {German} (3,0) node (DU) {Dutch}
(5,0) node (D) {Danish} (7,0) node (E) {English}
(9,0) node (F) {French} (1.5,2) node (SO) {SOV}
(1.5,1.6) node (V) {VC} (3,4) node (V2) {V2}
(7.7,2) node (S) {SVO};
\draw (main) -- (V2) -- (V2) -- (SO) (main) -- (S) -- (E)
(V2) -- (D) (S) -- (F) (S)--(D) (V) -- (G) (V) -- (DU) ;
\end{tikzpicture}
但最好不要使用坐标,没有树的库更好的方法是
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[every node/.style={anchor=base},node distance=2cm and 2cm,on grid]
\path node (GE) {German}
node[right=of GE] (DU) {Dutch}
node[right=3cm of DU] (DA) {Danish}
node[right=of DA] (EN) {English}
node[right=of EN] (FR) {French}
node[above=of DU,align=center] (VC) {SOV\\VC}
node[above =of EN] (SVO) {SVO}
node[above right=of VC] (V2) {V2}
coordinate[above right=of V2] (main) ;
\draw (main) -- (V2) -- (VC) -- (GE) (main) -- (SVO) -- (DA)
(VC)--(DU) (SVO) -- (EN)
(V2) -- (DA) (SVO) -- (FR) ;
\end{tikzpicture}
\end{document}