请问我该怎么做?谢谢!
这就是我正在做的事情:
\documentclass[showtrims, 10pt]{memoir}
\usepackage{forest}
\begin{document}
\begin{forest}
[,phantom,s sep=2cm
[X
[Raiz-{[-cons.]}
[Altura][P.A.V],name=a2
]
]
[X[Raiz-{[+cons.]}[{[+nasal]}]], oi
]
[X[Raiz-{[+cons.]}[P.A.C]]
]
[{[+cons.]},before drawing tree={y=0cm,x=0.8cm},oi,oi,anchor=west]
[{[-soante]},before drawing tree={y=0.65cm,x=0.5cm},oi,oi,anchor=north west]
]
\end{forest}
\end{document}
答案1
Forest 的一大优势是可以自动完成良好的布局。如果您不喜欢结果,通常可以使用定位库更轻松地添加一些元素。而且,在开始命名节点时,您做了正确的事。通过命名所有相关节点,可以轻松添加虚线以及现有连接上的装饰。
\documentclass[showtrims, 10pt]{memoir}
\usepackage{forest}
\usetikzlibrary{positioning,decorations.markings}
\begin{document}
\begin{forest}
for tree={calign=fixed edge angles,calign primary angle=-45,calign secondary angle=0}
[,phantom,s sep=2cm
[X
[Raiz-{[-cons.]},name=a2
[Altura]
[P.A.V]
]
]
[X,name=X2
[Raiz-{[+cons.]},name=Raiz2
[{[+nasal]},name=nas]
],green!50!blue
]
[X[Raiz-{[+cons.]},name=rh
[P.A.C]
]
]
]
\draw[dashed] (a2.south) -- (nas.north) -- (rh.south);
\node[above right=0.5cm of rh,green!50!blue] (cons) {[+cons.]};
\node[right=0.5cm of rh,green!50!blue] (soante) {[-soante]};
\draw[green!50!blue] (rh) -- (cons);
\draw[green!50!blue] (rh) -- (soante);
\draw[decorate,decoration={markings,mark=at position 0.5 with {
\draw (-1pt,-2pt) -- (-1pt,2pt);
\draw (1pt,-2pt) -- (1pt,2pt);}}] (Raiz2) -- (X2);
\end{forest}
\end{document}