我正在尝试在 Ruth 和 Anita 之下创建一个级别,以创建一个名为“Chris”的节点,其余部分保持与当前相同。
\documentclass{exam}
\usepackage{tikz-qtree}
\usetikzlibrary{shapes}
\usepackage{pdflscape}
\usepackage{caption}
\begin{document}
\begin{landscape}
\null\vfill
\noindent\resizebox{\textwidth}{!}{%
\tikzset{edge from parent/.style=
{draw, edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}},
blank/.style={draw=none},
level distance=45pt}
\begin{tikzpicture}[every tree node/.style={align=center,minimum width=\widthof{Janet Botwood}}]
\Tree [.\node(grands)[rectangle split,rectangle split horizontal,rectangle split parts=2]{Ruth Butler\\Registered Manager \nodepart{second} Anita Kaur\\Registered Manager};
[ .{Lisa Bradley\\RMN} ]
[ .{David Craddock\\RMN} ]
[ .{Tom Cullen\\RMN} ]
[ .{Jade Faid\\RMLD} ]
[ .{Raj Jaganaidoo\\RNLD} ]
[ .{Jairus Mabunda\\RMN} ]
[ .{Anamaria Noaom\\RMN} ]
[ .{Alicja Pdgorska\\RMN} ] ]
\end{tikzpicture}%
}
\vspace{10 mm}
\captionof{figure}{The Management Structure of Orchard House Nursing Home -- Draft}
\label{tikz}
\vfill
\end{landscape}
\end{document}
答案1
像这样?
\documentclass{exam}
\usepackage{tikz-qtree}
\usetikzlibrary{shapes}
\usepackage{pdflscape}
\usepackage{caption}
\begin{document}
\begin{landscape}
\null\vfill
\noindent\resizebox{\textwidth}{!}{%
\tikzset{edge from parent/.style=
{draw, edge from parent path={(\tikzparentnode.south)
-- +(0,-8pt)
-| (\tikzchildnode)}},
blank/.style={draw=none},
level distance=45pt}
\begin{tikzpicture}[every tree node/.style={align=center,minimum width=\widthof{Janet Botwood}}]
\Tree [.\node(grands)[rectangle split,rectangle split horizontal,rectangle split parts=2]{Ruth Butler\\Registered Manager \nodepart{second} Anita Kaur\\Registered Manager};
[ .{Chris} %<-----------------New node
[ .{Lisa Bradley\\RMN} ]
[ .{David Craddock\\RMN} ]
[ .{Tom Cullen\\RMN} ]
[ .{Jade Faid\\RMLD} ]
[ .{Raj Jaganaidoo\\RNLD} ]
[ .{Jairus Mabunda\\RMN} ]
[ .{Anamaria Noaom\\RMN} ]
[ .{Alicja Pdgorska\\RMN} ] ] ] %<------- Another ]
\end{tikzpicture}%
}
\vspace{10 mm}
\captionof{figure}{The Management Structure of Orchard House Nursing Home -- Draft}
\label{tikz}
\vfill
\end{landscape}
\end{document}
更新:
顶部和下方的双节点意味着您要绘制的结构不是树,尽管可以使用tikz-qtree
或巧妙TikZ
地forest
绘制它们,但我认为非树的TikZ
解决方案可能更容易。
下面的代码展示了一个包含多个解决方案matrix
,每个级别一个,以及一些foreach
在节点之间绘制连接的循环。
\documentclass[tikz]{standalone}
\usetikzlibrary{matrix, positioning}
\begin{document}
\begin{tikzpicture}[person/.style={align=center, text width=\widthof{#1}},
level/.style={matrix of nodes, nodes={person, text align=center}}]
\matrix[matrix of nodes, nodes={person=Registered Manager}] (RM) {{Ruth Butler\\ Registered Manager} & {Janet Botwood\\ Registered Manager}\\};
\matrix[matrix of nodes, nodes={person=Something else}, below= 5mm of RM] (Ch) {{Chris\\ Something else}\\};
\matrix[matrix of nodes, nodes={person=Anamaria Noaom},
below= 5mm of Ch] (RMN) {{Lisa Bradley\\RMN} &
{David Craddock\\RMN} &
{Tom Cullen\\RMN} &
{Jade Faid\\RMLD} &
{Raj Jaganaidoo\\RNLD} &
{Jairus Mabunda\\RMN} &
{Anamaria Noaom\\RMN} &
{Alicja Pdgorska\\RMN} \\};
\matrix[matrix of nodes, nodes={person=Janet},
below= 5mm of RMN] (BRMN) {{Janet} &
{Sunny}\\};
\foreach \i in {1,2}
\draw (RM-1-\i.south)--++(-90:3mm) -| (Ch-1-1.north);
\foreach \i in {1,2,...,8}
\draw (Ch-1-1.south)--++(-90:3mm) -| (RMN-1-\i.north);
\foreach \i in {1,2,...,8}
\draw (RMN-1-\i.south)--++(-90:3mm) -| (BRMN.north);
\foreach \i in {1,2}
\draw (BRMN.north) -| (BRMN-1-\i.north);
\end{tikzpicture}
\end{document}