我正在使用提供的脚本这里绘制多层次图表。
但是当我运行应该生成上述图表的相同脚本时,我得到的是扭曲的箭头。我使用(Win. 11 中的 TeXstudio 4.3.1 编辑器)运行脚本。这是我得到的输出:
这是应该产生第一个图形的脚本,但我得到的是扭曲的箭头。
\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,shadows.blur}
\begin{document}
\newlength\gap
\setlength\gap{10mm}
\begin{forest}
forked edges,
for tree={
draw=blue!80!darkgray,
fill=blue!80!darkgray!25,
rounded corners,
minimum width=(\textwidth-6*\gap)/3,
minimum height=4ex,
edge={-Latex},
font=\sffamily,
text centered,
blur shadow,
},
where={level()<=1}{%
parent anchor=children,
}{%
folder,
grow'=0,
l sep+=5pt,
if level=2{%
before typesetting nodes={child anchor=north},
!u.s sep'+=10pt,
edge path'={%
(!u.parent anchor) -- ++(0,-10pt) -| (.child anchor)
},
}{},
}
[Active Media
[Gases
[Atoms
[He-Ne]
[I]
]
[Molecules
[CO2]
[CO]
]
[Ions
[Ar]
[Kr]
]
[Excimers
[ArF]
]
]
[Liquids
[Dyes
[Rhodamines]
]
]
[Solids
[Insulators
[Nd:YAG]
]
[Semiconductors
[GaAs]
]
]
]
\end{forest}
\end{document}
编辑: 在里面参考代码,我采用的是所选答案中的代码,而不是原始帖子中的代码。
答案1
对整个树使用forked edge
内部where
而不是:forked edges
\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{arrows.meta,shadows.blur}
\begin{document}
\newlength\gap
\setlength\gap{10mm}
\begin{forest}
%forked edges,
for tree={
draw=blue!80!darkgray,
fill=blue!80!darkgray!25,
rounded corners,
minimum width=(\textwidth-6*\gap)/3,
minimum height=4ex,
edge={-Latex},
font=\sffamily,
text centered,
blur shadow,
},
where={level()<=1}{%
parent anchor=children, forked edge
}{%
folder,
grow'=0,
l sep+=5pt,
if level=2{%
before typesetting nodes={child anchor=north},
!u.s sep'+=10pt,
edge path'={%
(!u.parent anchor) -- ++(0,-10pt) -| (.child anchor)
},
}{},
}
[Active Media
[Gases
[Atoms
[He-Ne]
[I]
]
[Molecules
[CO2]
[CO]
]
[Ions
[Ar]
[Kr]
]
[Excimers
[ArF]
]
]
[Liquids
[Dyes
[Rhodamines]
]
]
[Solids
[Insulators
[Nd:YAG]
]
[Semiconductors
[GaAs]
]
]
]
\end{forest}
\end{document}