我希望改编自以下组织结构图如何将我的 Word 组织结构图转换为 Latex正如@alien 所回复的(非常感谢@alien)。代码运行得很好。但是,级别 3 和 4(运行、测试和 em_real)的矩形比级别 1 和 2 的矩形大。其次,这些级别(3 和 4)的文本未居中。是否可以减小这些级别的矩形大小,并将文本居中?如能提供帮助,我们将不胜感激。
\documentclass[tikz,border=5pt,multi]{standalone}
\usepackage{forest,array}
\usetikzlibrary{shadows}
\newcolumntype{C}[1]{>{\centering}p{#1}}
\begin{document}
\begin{forest}
for tree={
if level=0{align=center}{% allow multi-line text and set alignment
align={@{}C{25mm}@{}},
},
draw,
font=\sffamily\bfseries,
edge path={
\noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) -- +(0,-5mm) -| (.child anchor)\forestoption{edge label};
},
parent anchor=south,
child anchor=north,
l sep=10mm,
tier/.wrap pgfmath arg={tier #1}{level()},
edge={ultra thick, rounded corners=2pt},
ultra thick,
inner color=blue,
outer color=gray!20,
rounded corners=2pt,
drop shadow,
s sep=0.5cm,
minimum width=2cm,
minimum height=1cm,
}
[DA
[WPS]
[WRF
[\color{green}run]
[\color{orange}test
[\color{green}em\_real]
]
]
[3DVAR]
[4DVAR]
]
\end{forest}
\end{document}
答案1
\documentclass[tikz, border=1cm]{standalone}
\usepackage{forest, array}
\usetikzlibrary{shadows}
\begin{document}
\begin{forest}
for tree={
draw,
font=\sffamily\bfseries,
edge path={
\noexpand\path[draw, \forestoption{edge}] (!u.parent anchor) -- +(0,-5mm) -| (.child anchor)\forestoption{edge label};
},
parent anchor=south,
child anchor=north,
l sep=10mm,
tier/.wrap pgfmath arg={tier #1}{level()},
edge={ultra thick, rounded corners=2pt},
ultra thick,
inner color=blue,
outer color=gray!20,
rounded corners=2pt,
drop shadow,
s sep=0.5cm,
minimum width=1.8cm,
minimum height=0.6cm,
}
[DA
[WPS]
[WRF
[\color{green}run]
[\color{orange}test
[\color{green}em\_real]
]
]
[3DVAR]
[4DVAR]
]
\end{forest}
\end{document}