我正在准备提案,目前正在处理 Latex 中组织结构图中的一些问题。
\usepackage[margin=3cm]{geometry}
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\tikzstyle{every node}=[draw=black,thick,anchor=center, minimum height=2.5em]
\begin{document}
\KOMAoptions{paper=landscape,pagesize}
\recalctypearea
\begin{figure}[!htb]
\resizebox{\linewidth}{!}{
\begin{tikzpicture}[
criteria/.style={text centered, text width=3cm, fill=gray!50},
attribute/.style={%
grow=down, xshift=0cm,
text centered, text width=3cm,
edge from parent path={(\tikzparentnode.225) |- (\tikzchildnode.center)}},
first/.style ={level distance=8ex},
second/.style ={level distance=16ex},
third/.style ={level distance=24ex},
fourth/.style ={level distance=32ex},
fifth/.style ={level distance=40ex},
sixth/.style ={level distance=48ex},
level 1/.style={sibling distance=11em}]
% Main Goal
\node[anchor=center]{Committee Members}
[edge from parent fork down]
% Criteria and Attributes
child{node [criteria] {Project Advisor}
child[attribute,first] {node {Name}}}
[edge from parent fork down]
child{node (crit1) [criteria] {Group Leader}
child[attribute,first] {node {Name}}}
child{node [criteria] {Assistant Group Leader}
child[attribute,first] {node {Namen}}}
[edge from parent fork down]
child{node (crit1) [criteria] {Department of Logistics}
child[attribute,first] {node {Namen}}
child[attribute,second] {node {Name}}
child[attribute,third] {node {Name}}
child[attribute,fourth] {node {Name}}
child[attribute,fifth] {node {Name}}}
%
child{node [criteria] {Department of Design}
child[attribute,first] {node {Name}}
child[attribute,second] {node {Name}}
child[attribute,third] {node {Name}}
child[attribute,fourth] {node {Name}}
child[attribute,fifth] {node {Name}}
child[attribute,sixth] {node {Name}}}
%
child{node [criteria] {Department of Publicity}
child[attribute,first] {node {Name}}
child[attribute,second] {node {Name}}
child[attribute,third] {node {Name}}
child[attribute,fourth] {node {Name}}}
%
child{node [criteria] {Sponsorship Coordinator}
child[attribute,first] {node {Name}}
child[attribute,second] {node {Name}}
child[attribute,third] {node {Name}}
child[attribute,fourth] {node {Name}}
child[attribute,fifth] {node {Name}}
child[attribute,sixth] {node {Name}}}
%
child{node [criteria] {Video Production Team}
child[attribute,first] {node {Name}}
child[attribute,second] {node {Name}}
child[attribute,third] {node {Name}}
child[attribute,fourth] {node {Name}}};
\end{tikzpicture}}
\caption{Organisation Chart.}
\end{figure}
\end{document}
我在处理单元格之间的连线时遇到了问题,而且在图表的第三级和第四级之间插入新单元格似乎很困难。我希望在 Latex 中制作如下图所示的图表:
我该如何解决这个问题,以便组织结构图看起来清晰美观?
答案1
欢迎来到 TeX-SE!这不是对你的问题的完整回答,但是为了引起你的注意forest
软件包的注意,它基于 Ti钾Z。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
forked edges,
for tree={draw=black,thick,anchor=center, minimum height=2.5em,
text centered, text width=3cm,s sep+=1em,
where level=1{fill=gray!50}{},
where level=3{fill=gray!50}{},
where level=5{fill=gray!50}{}
}
[Committee Members
[Project Advisor
[Name
[Group leader
[Name]
]
[Assistant Group leader
[Name
[Department of Logistics
[Name
[Name
[Name
[Name
[Name
]
]
]
]
]
]
[Department of Design
[Name
[Name
[Name
[Name
[Name
[Name]
]
]
]
]
]
]
[Department of Publicity
[Name
[Name
[Name
[Name
]
]
]
]
]
[Sponsorship coordinator
[Name
[Name
[Name
[Name
[Name
[Name]
]
]
]
]
]
]
[Video production team
[Name
[Name
[Name
[Name
]
]
]
]
]
]
]
]
]
]
\end{forest}
\end{document}
我很难理解你手绘的图表,但它可能不是树,所以如果不是,trees
那么两者都不是最佳选择。人们可以改用矩阵。forest
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[F/.style={fill=gray!50}]
\matrix[matrix of nodes,column sep=1em,row sep=2em,
nodes={text width=3cm,text centered,draw}]
(mat)
{
& & |[F]| unreadable & & \\
& & Name & & \\
& |[F]| unreadable & & |[F]| unreadable & \\
& Name & & Name & \\[4em]
& |[F]| unreadable & & |[F]| unreadable & \\
& Name & & Name & \\
& Name & & Name & \\[4em]
|[F]| Dept & |[F]| Dept & |[F]| Dept & |[F]| Dept & |[F]| Dept \\
Name & Name & Name & Name & Name \\
Name & Name & Name & Name & Name \\
};
\draw (mat-1-3) -- (mat-2-3)
(mat-2-3.south) -- ++ (0,-1em) -| (mat-3-2)
(mat-2-3.south) -- ++ (0,-1em) -| (mat-3-4)
(mat-3-2) -- (mat-4-2)
(mat-3-4) -- (mat-4-4)
(mat-4-2.south) -- ++ (0,-1em) coordinate (aux0) -- (mat-1-3|-aux0) coordinate
(aux1) -- ++(0,-2em) -| (mat-5-2)
(mat-4-4.south) |- (aux1) -- ++(0,-2em) -| (mat-5-4)
(mat-5-2) -- (mat-6-2) (mat-5-4) -- (mat-6-4)
(mat-6-2) -- (mat-7-2) (mat-6-4) -- (mat-7-4)
(mat-7-2.south) -- ++ (0,-1em) coordinate (aux2) -- (mat-1-3|-aux2) coordinate
(aux4) -- ++ (0,-2em) coordinate (aux5)
(mat-7-4.south) |- (aux4)
foreach \X in {1,...,5} {(aux5) -| (mat-8-\X)
(mat-8-\X.west) -- ++ (-0.5em,0) |- (mat-9-\X)
(mat-8-\X.west) -- ++ (-0.5em,0) |- (mat-10-\X)};
\end{tikzpicture}
\end{document}