![我怎样在 Latex 中绘制这种类型的层次结构图?](https://linux22.com/image/456064/%E6%88%91%E6%80%8E%E6%A0%B7%E5%9C%A8%20Latex%20%E4%B8%AD%E7%BB%98%E5%88%B6%E8%BF%99%E7%A7%8D%E7%B1%BB%E5%9E%8B%E7%9A%84%E5%B1%82%E6%AC%A1%E7%BB%93%E6%9E%84%E5%9B%BE%EF%BC%9F.png)
更新
我尝试了其中一种建议的解决方案。我为我的图表编写了此代码。但中心节点的大小不同。而且,它们没有对齐。
\documentclass{article}
\usepackage{tikz,amsmath}
\usepackage{amsmath,pifont,amssymb,yfonts, amsfonts, stmaryrd, pxfonts,eufrak, fancybox, bbm}
\usetikzlibrary{fit}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usepackage{rotating}
\usetikzlibrary{shapes.geometric, arrows}
\usepackage[paperheight=20in,paperwidth=6in,margin=0.1in]{geometry}
\usetikzlibrary{petri,decorations.markings}
\tikzstyle{process} = [auto, rectangle, minimum width=3em, minimum height=2em, text centered, draw=blue, fill=gray!10, rounded corners, node distance=4cm ]
\tikzstyle{cloud} = [ellipse, minimum width=2em, minimum height=2.5em, text centered, draw=blue, fill=red!10]
\tikzstyle{block} = [rectangle, minimum width=1em, minimum height=5em, text centered, draw= green, fill=green!10]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{line} = [ thick, color=black!150]
\pagestyle{plain}
\begin{document}
\begin{tikzpicture}
% Text orientation is wrong
\node (S) [block]{\rotatebox{90}{Selection of green supplier}};
% \begin{scope}[node distance=2mm and 3mm]
[
\node (S1) [process, above right=0.25cm and 3cm of S]{service and delivery $\left( {{\mathfrak{h}}_{5}}\right) $};
\node (S2) [process, below right=0.25cm and 3cm of S]{ the reputation of the supplier $\left( {{\mathfrak{h}}_{6}}\right) $};
\node (S3) [process, above =0.25cm and 3cm of S1]{operational and transportation cost $\left( {{\mathfrak{h}}_{4}}\right) $ };
\node (S4) [process, above =0.25cm and 3cm of S3]{supply chain flexibility $\left( {{\mathfrak{h}}_{3}}\right) $ };
\node (S5) [process, above =0.1cm and 3cm of S4]{quality $\left( {{\mathfrak{h}}_{2}}\right) $};
\node (S6) [process, above =0.1cm and 3cm of S5]{ Price $\left( {{\mathfrak{h}}_{1}}\right) $ };
\node (S7) [process, below =0.1cm and 3cm of S2]{green competencies $\left( {{\mathfrak{h}}_{7}}\right) $};
\node (S8) [process, below =0.1cm and 3cm of S7]{use of green packaging $\left( {{\mathfrak{h}}_{8}}\right) $};
\node (S9) [process, below =0.1cm and 3cm of S8]{environment management and control $\left( {{\mathfrak{h}}_{9}}\right) $};
\node (S10) [process, below =0.1cm and 3cm of S9]{use of eco-friendly technology $\left( {{\mathfrak{h}}_{10}}\right) $};
\node (S11) [cloud, below right=1.9cm and 5cm of S1]{${\mathcal{P}_{1}}$ };
\node (S12) [cloud, above=0.7cm and 5cm of S11]{${\mathcal{P}_{2}}$ };
\node (S13) [cloud, above=0.7cm and 5cm of S12]{${\mathcal{P}_{3}}$ };
\node (S14) [cloud, above=0.7cm and 5cm of S13]{${\mathcal{P}_{4}}$ };
\node (S15) [cloud, below=0.7cm and 5cm of S11]{${\mathcal{P}_{5}}$ };
\node (S16) [cloud, below=0.7cm and 5cm of S15]{${\mathcal{P}_{6}}$ };
\node (S17) [cloud, below=0.7cm and 5cm of S16]{${\mathcal{P}_{7}}$ };
]
% \end{scope}
\draw (S) edge[->,out=0,in=180] (S1);
\draw (S) edge[->,out=0,in=180] (S2);
\draw (S) edge[->,out=0,in=180] (S3);
\draw (S) edge[->,out=0,in=180] (S4);
\draw (S) edge[->,out=0,in=180] (S5);
\draw (S) edge[->,out=0,in=180] (S6);
\draw (S) edge[->,out=0,in=180] (S7);
\draw (S) edge[->,out=0,in=180] (S8);
\draw (S) edge[->,out=0,in=180] (S9);
\draw (S) edge[->,out=0,in=180] (S10);
\draw (S1) edge[>->,out=0,in=180] (S11);
\draw (S1) edge[>->,out=0,in=180] (S12);
\draw (S1) edge[>->,out=0,in=180] (S13);
\draw (S1) edge[>->,out=0,in=180] (S14);
\draw (S1) edge[>->,out=0,in=180] (S15);
\draw (S1) edge[>->,out=0,in=180] (S16);
\draw (S1) edge[>->,out=0,in=180] (S17);
\draw (S2) edge[>->,out=0,in=180] (S11);
\draw (S2) edge[>->,out=0,in=180] (S12);
\draw (S2) edge[>->,out=0,in=180] (S13);
\draw (S2) edge[>->,out=0,in=180] (S14);
\draw (S2) edge[>->,out=0,in=180] (S15);
\draw (S2) edge[>->,out=0,in=180] (S16);
\draw (S2) edge[>->,out=0,in=180] (S17);
\draw (S3) edge[>->,out=0,in=180] (S11);
\draw (S3) edge[>->,out=0,in=180] (S12);
\draw (S3) edge[>->,out=0,in=180] (S13);
\draw (S3) edge[>->,out=0,in=180] (S14);
\draw (S3) edge[>->,out=0,in=180] (S15);
\draw (S3) edge[>->,out=0,in=180] (S16);
\draw (S3) edge[>->,out=0,in=180] (S17);
\draw (S4) edge[>->,out=0,in=180] (S11);
\draw (S4) edge[>->,out=0,in=180] (S12);
\draw (S4) edge[>->,out=0,in=180] (S13);
\draw (S4) edge[>->,out=0,in=180] (S14);
\draw (S4) edge[>->,out=0,in=180] (S15);
\draw (S4) edge[>->,out=0,in=180] (S16);
\draw (S4) edge[>->,out=0,in=180] (S17);
\draw (S5) edge[>->,out=0,in=180] (S11);
\draw (S5) edge[>->,out=0,in=180] (S12);
\draw (S5) edge[>->,out=0,in=180] (S13);
\draw (S5) edge[>->,out=0,in=180] (S14);
\draw (S5) edge[>->,out=0,in=180] (S15);
\draw (S5) edge[>->,out=0,in=180] (S16);
\draw (S5) edge[>->,out=0,in=180] (S17);
\draw (S6) edge[>->,out=0,in=180](S11);
\draw (S6) edge[>->,out=0,in=180] (S12);
\draw (S6) edge[>->,out=0,in=180] (S13);
\draw (S6) edge[>->,out=0,in=180] (S14);
\draw (S6) edge[>->,out=0,in=180] (S15);
\draw (S6) edge[>->,out=0,in=180] (S16);
\draw (S6) edge[>->,out=0,in=180] (S17);
\draw (S7) edge[>->,out=0,in=180] (S11);
\draw (S7) edge[>->,out=0,in=180](S12);
\draw (S7) edge[>->,out=0,in=180] (S13);
\draw (S7) edge[>->,out=0,in=180] (S14);
\draw (S7) edge[>->,out=0,in=180] (S15);
\draw (S7) edge[>->,out=0,in=180] (S16);
\draw (S7) edge[>->,out=0,in=180] (S17);
\draw (S8) edge[>->,out=0,in=180] (S11);
\draw (S8) edge[>->,out=0,in=180] (S12);
\draw (S8) edge[>->,out=0,in=180] (S13);
\draw (S8) edge[>->,out=0,in=180](S14);
\draw (S8) edge[>->,out=0,in=180] (S15);
\draw (S8) edge[>->,out=0,in=180] (S16);
\draw (S8) edge[>->,out=0,in=180] (S17);
\draw (S9) edge[>->,out=0,in=180] (S11);
\draw (S9) edge[>->,out=0,in=180] (S12);
\draw (S9) edge[>->,out=0,in=180] (S13);
\draw (S9) edge[>->,out=0,in=180] (S14);
\draw (S9) edge[>->,out=0,in=180] (S15);
\draw (S9) edge[>->,out=0,in=180] (S16);
\draw (S9) edge[>->,out=0,in=180] (S17);
\draw (S10) edge[>->,out=0,in=180] (S11);
\draw (S10) edge[>->,out=0,in=180] (S12);
\draw (S10) edge[>->,out=0,in=180] (S13);
\draw (S10) edge[>->,out=0,in=180] (S14);
\draw (S10) edge[>->,out=0,in=180] (S15);
\draw (S10) edge[>->,out=0,in=180] (S16);
\draw (S10) edge[>->,out=0,in=180] (S17);
\end{tikzpicture}
\end{document}
答案1
你的问题不清楚!你的问题是什么?
- 重新创建显示的图像?
- 清理并纠正“答案”中的代码,以便编译结果与问题中显示的图像更相似?
- 到目前为止,您答案中文档的编译甚至还与所显示的图像相差甚远。
举个例子,“答案”中的代码可以是这样的:
\documentclass{article}
\usepackage[paperheight=20in,paperwidth=6in,margin=0.1in]{geometry}
\usepackage{amsmath, amssymb, eufrak}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
calc, chains,
positioning}
\begin{document}
\begin{tikzpicture}[
node distance = 2mm and 22mm,
start chain = A going below,
start chain = B going below,
N/.style = {draw=blue, fill=gray!20,
text width=#1, align=flush center},
C/.style = {circle, draw=blue, fill=red!20,
minimum size=1.5em}
]
\begin{scope}[nodes={N=44mm, on chain=A}]
\node {Price $(\mathfrak{h}_{1})$ }; % node name = A-1
\node {quality $(\mathfrak{h}_{2})$};
\node {supply chain flexibility $(\mathfrak{h}_{3})$};
\node {operational and transportation cost $(\mathfrak{h}_{4})$};
\node {service and delivery $(\mathfrak{h}_{5})$};
\node {reputation and suplayer $(\mathfrak{h}_{6})$};
\node {green competencies $(\mathfrak{h}_{7})$};
\node {use of green packaging $(\mathfrak{h}_{8})$};
\node {environment management and control $(\mathfrak{h}_{9})$};
\node {use of eco-friendly technology $(\mathfrak{h}_{10}) $};
\end{scope}
\node (S) [N=22mm, fill=orange!30, left=of A-6]
{Selection of green supplier};
\begin{scope}[nodes={C, on chain=B}]
\node [right=of {$(A-2.east)!0.5!(A-3.east)$}]
{${\mathcal{P}_{1}}$ }; % node name = B-1
\node {${\mathcal{P}_{2}}$ };
\node {${\mathcal{P}_{3}}$ };
\node {${\mathcal{P}_{4}}$ };
\node {${\mathcal{P}_{5}}$ };
\node {${\mathcal{P}_{6}}$ };
\node {${\mathcal{P}_{7}}$ };
\end{scope}
\foreach \i in {1,2,...,10}
\draw (S.east) -- (A-\i.west);
\foreach \i in {1,...,10}
{
\foreach \j in {1,...,7}
\draw (A-\i.east) -- (B-\j.west);
}
\end{tikzpicture}
\end{document}
答案2
您的代码仍然不是最小工作示例(MMW)。以下是针对您的问题的可能 MWE。
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\tikzset{
myfill/.style={draw=teal,thick,top color=white, bottom color=cyan,align=center},
Lbox/.style={myfill,minimum width=3.5cm,inner sep=5mm},
Cbox/.style={myfill,minimum width=4.8cm,minimum height=1.2cm},
Rbox/.style={myfill,minimum width=3.5cm,minimum height=1.8cm}
}
\tikzset{declare function={a=6;b=.75;}} % for distances in center boxes
\path
(0,0) node[Lbox] (L) {Selection of the\\Renewable Energy \\Sources}
(a,b) node[Cbox] (Water) {Water pollution}
(a,-b) node[Cbox] (Pollutant) {Pollutant emission}
(a,3*b) node[Cbox] (Operation) {Operation and maintenance\\cost}
(a,-3*b) node[Cbox] (Land) {Land requirement}
;
\tikzset{declare function={c=6;d=1.1;}} % for distances in right boxes
\path (Water)++(0,-.8)
+(c,d) node[Rbox] (Wind) {Wind energy}
+(c,-d) node[Rbox] (Hydropower) {Hydropower energy}
+(c,3*d) node[Rbox] (Solar) {Solar energy}
+(c,-3*d) node[Rbox] (Biomass) {Biomass energy}
(Water.east)+(.6,0) coordinate (A)
;
\foreach \i in {Water,Pollutant,Operation,Land}
\draw[magenta] (L.east)--(\i.west) (A)|-(\i.east);
\foreach \i in {Solar,Wind,Hydropower,Biomass}
\draw[magenta] (A)--(\i.west);
\end{tikzpicture}
\end{document}