强制节点的水平对齐不受 tikz qtree 中较低级别的影响

强制节点的水平对齐不受 tikz qtree 中较低级别的影响

我正在尝试创建一个大型层次结构,但遇到了以下问题:由于某些标签非常宽,它们会使上层的节点移开。这意味着树的可读性会降低,因为我必须缩小它才能使其适合页面。因此,我想制作,例如,价值地点目标靠得更近一些,这样目标重叠初始位置

我曾尝试过调整单个级别的(负)兄弟距离以及定义节点宽度。

我需要使用 tikz qtree,因为我需要能够指定多个父级。

\documentclass[]{standalone}
\usepackage{tikz-qtree} 

\begin{document}

\begin{tikzpicture}
\tikzset{every tree node/.style={align=center},level distance=80pt, sibling distance=20pt}
\Tree 
[.\textit{entity} 
[. \textit{place}
[. \textit{value}\\\textsc{scale}
[. \textit{extent}
[. \textit{amount}
]
]
]
[. \textit{location}\\{\textsc{concreteness} : \textit{concrete}}
[.\node (dest) {\textit{destination}};
]
[.\node (init) {\textit{initial location}};
]
]
[.\node (goal) {\textit{goal}};
]
[.\node (sour) {\textit{source}};
]
]
[.\textit{undergoer}
[. \textit{patient}\\{\textsc{affectedness} : \textit{affected}}
[.\node (resu) {\textit{result}};
[. \textit{product}
]
]
[. \textit{experiencer}\\{\textsc{awareness} : \textit{aware}}
]
]
[. \textit{theme}\\{\textsc{affectedness} : \textit{unaffected}}
]
[. \textit{attribute}
]
]   
[.\textit{actor}
[.\textit{agent}\\{\textsc{intention}}
]
[.\textit{causer}
[. \textit{stimulus}
]
]
[. \textit{instrument}
]
]               
]   
\draw (dest.north) -- (goal.south); 
\draw (init.north) -- (sour.south); 
\draw (resu.north) -- (goal.south); 
\end{tikzpicture}

\end{document}

请随意重命名此主题,因为我很难找到一个好的标题。

答案1

这是使用 的树的版本forest

\documentclass[]{standalone}
\usepackage[linguistics]{forest} 
\begin{document}

\begin{forest} for tree={font=\itshape,l sep=1.5cm}
[entity 
[place
[value\\\textsc{scale}
[extent
[amount
]
]
]
[location\\{\textsc{concreteness} : concrete}
[destination,name=dest
]
[initial location,name=init]
]
[goal,name=goal
]
[source,name=sour
]
]
[undergoer
[patient\\{\textsc{affectedness} : affected}
[result,name=resu
[product
]
]
[experiencer\\{\textsc{awareness} : aware}
]
]
[theme\\{\textsc{affectedness} : unaffected}
]
[attribute
]
]
[actor
[agent\\{\textsc{intention}}
]
[causer
[stimulus
]
]
[instrument
]
]
]
\draw (dest.north) -- (goal.south); 
\draw (init.north) -- (sour.south); 
\draw (resu.north) -- (goal.south); 
\end{forest}

\end{document}

代码输出

相关内容