我使用以下代码(MWE)组合了一个语言树:
\documentclass[b5paper,11pt,twoside,one column,openright,draft]{memoir}
\usepackage{rotating}
\usepackage{tikz-qtree}
\usepackage{tikz-qtree-compat}
\tikzset{every tree node/.style={align=center, anchor=north}} % to allow linebreaks
\begin{document}
\newlength{\egyptianlength}
\settowidth{\egyptianlength}{Egyptian}
\newlength{\msarabianlength}
\settowidth{\msarabianlength}{Modern South Arabian}
\newlength{\nwsemiticlength}
\settowidth{\nwsemiticlength}{Northwest Semitic}
\newlength{\canaanitelength}
\settowidth{\canaanitelength}{Canaanite}
\newlength{\pplength}
\settowidth{\pplength}{Phoenician/Punic}
\begin{figure}[p]
\begin{center}
\begin{turn}{90}
\begin{tikzpicture}
\tikzset{every tree node/.style={align=center,anchor=north,level distance=2\baselineskip}}
\tikzset{edge from parent/.style={draw,thick}}
\tikzset{level distance=2\baselineskip}
\Tree [.{Afro-Asiatic}
[.{\makebox[\egyptianlength][c]{Berber}} ]
[.{\makebox[\egyptianlength][c]{Chadic}} ]
[.{\makebox[\egyptianlength][c]{Egyptian}} ]
[.\node (Semitic) {\makebox[\egyptianlength][c]{Semitic}}; ]
[.{\makebox[\egyptianlength][c]{Cushitic}} ]
[.{\makebox[\egyptianlength][c]{Omotic}} ]
]
\node[below of=Semitic,yshift=-1.5em,xshift=-5.5em]{
\Tree [
[.{West Semitic}
[.{\makebox[\msarabianlength][c]{Ethiopian}} ]
[.\node (CentralSemitic) {\makebox[\msarabianlength][c]{Central Semitic}}; ]
[.{\makebox[\msarabianlength][c]{Modern South Arabian}} ]
]
[.{East Semitic}
Eblaite
Akkadian
]
]
};
\node[below of=CentralSemitic,yshift=-9.5em,xshift=-7.5em]{
\Tree [
[.{\makebox[\nwsemiticlength][c]{Old South Arabian}} ]
[.\node (NWSemitic) {{\makebox[\nwsemiticlength][c]{Northwest Semitic}}}; ]
[.{\makebox[\nwsemiticlength][c]{Arabic}} ]
]
};
\node[below of=NWSemitic,yshift=-13.75em,xshift=-8em]{
\Tree [
[.{\makebox[\canaanitelength][c]{Ugaritic}} ]
[.{\makebox[\canaanitelength][c]{Aramaic}} ]
[.\node (Canaanite) {{\makebox[\canaanitelength][c]{Canaanite}}}; ]
]
};
\node[below of=Canaanite,yshift=-17.75em,xshift=-3.1em]{
\Tree [
[.{\makebox[\pplength][c]{Phoenician/Punic}} ]
[.{\makebox[\pplength][c]{Moabite}} ]
[.{\makebox[\pplength][c]{Ammonite}} ]
[.{\makebox[\pplength][c]{Edomite}} ]
[.{\makebox[\pplength][c]{Hebrew}} ]
]
};
\end{tikzpicture}
\end{turn}
\end{center}
\caption{The Semitic languages in their Afro-Asiatic context}
\end{figure}
\end{document}
长度和 \makebox-es 的巧妙使用让树看起来不那么歪斜。但是,我有一个问题,并且希望有“更好的方法”...
问题:例如“西闪米特语”和“中部闪米特语”之间的垂直距离(就行长而言)比“中部闪米特语”和“西北闪米特语”之间的垂直距离小得多。
增强:如果 xshift 和 yshifts(我目前通过反复试验确定)可以相对(即从标签文本中点的基线下拉 x)那就太好了。
有什么建议吗?我尝试根据提供的信息调整垂直距离这里但没有成功。也许我做得不对……
谢谢!
答案1
使用标准树似乎更容易tikz
。在这些树中,给定级别的节点间距均匀,垂直间距更均匀。您可以通过设置来调整子树中的水平间距sibling distance
:
\documentclass{article}
\usepackage{rotating}
\usepackage{tikz}
\begin{document}
\begin{figure}[p]
\centering
\begin{turn}{90}
\begin{tikzpicture}
\path[level distance=35pt,parent anchor=south,child
anchor=north,text height=7pt,text depth=0pt,thick]
node{Afro-Asiatic} [sibling distance=2cm]
child {node{Berber}}
child {node{Chadic}}
child {node{Egyptian}}
child {node{Semitic} [sibling distance=7cm]
child {node{West Semitic} [sibling distance=3.5cm]
child {node{Ethiopian}}
child {node{Central Semitic} [sibling distance=3.2cm]
child {node{Old South Arabian}}
child {node{Northwest Semitic} [sibling distance=2cm]
child {node{Ugartic}}
child {node{Aramic}}
child {node{Canaanite} [sibling distance=2.5cm]
child {node{Phoenician/Punic}}
child {node{Moabite}}
child {node{Ammonite}}
child {node{Edomite}}
child {node{Hebrew}}}}
child {node{Arabic}}}
child {node{Modern South Arabian}}}
child {node{East Semitic} [sibling distance=1.5cm]
child {node{Eblaite}}
child {node{Akkadian}}}}
child {node{Cushitic}}
child {node{Omotic}} ;
\end{tikzpicture}
\end{turn}
\caption{The Semitic languages in their Afro-Asiatic context}
\end{figure}
\end{document}
所有路径都从父节点上的给定点下降,正如我所指定的parent anchor=south
,而不是标准的border
。
我已经指定text height
并text depth
确保文本具有降部部分的节点与没有降部部分的节点对齐。