讓我們考慮一個非常簡單的樹,如下所示:
\documentclass[12pt]{beamer}
\usepackage{qtree, tikz-qtree, tikz}
\begin{document}
\begin{frame}{Title}
\begin{tikzpicture}
\Tree
[.XP
[.X ] [.compl ] ]
\end{tikzpicture}
\end{frame}
\end{document}
在其自然形式下,它看起來像兩個對稱的分支 /\ 。我怎麼能讓它看起來像|\(或最終相反,/|)。換句話說,鑑於我只使用二元分支,我如何「告訴我的樹」將一個分支筆直,另一個分支斜左斜右?我最終可能想畫一棵這樣的樹:
|\
|\
/|
答案1
我不知道與qtree
但與forest
calign=first
使用選項或很容易calign=last
。
\documentclass[12pt]{beamer}
%\usepackage{qtree, tikz-qtree, tikz}
\usepackage{forest}
\begin{document}
\begin{frame}{Title}
\begin{forest}
[XP, for tree={calign=first}
[X [a [A, calign=last [B] [D]] [B]] [b] [c]] [compl, calign=last [A] [B] ] ]
\end{forest}
\end{frame}
\end{document}