是否有可能创建一个与子节点或孙节点处于同一级别的框,但不是第一个节点(石油财富)的后代?想象一个名为“ABC”的孤立框,它没有从上方任何框派生的箭头。谢谢
\usepackage{forest}
\usetikzlibrary{arrows.meta,
shadows}
\tikzset{arr/.style = {draw, -{Stealth[length=2mm]}},
every edge/.style = {arr}
}
\usepackage{lipsum} % for dummy text filler
\begin{document}
\section{Tree}\label{sec6}
\lipsum[66]
\begin{figure}[ht]
\centering
\begin{forest}
for tree={
% nodes
draw, semithick, rounded corners,
fill=green!39, drop shadow,
text width=7em, text centered,
font=\sffamily,
% tree
s sep = 4mm,
l sep = 13mm,
edge = {arr},
}
[Oil Wealth, fill=cyan, sharp corners
[Grandparent
[Parent
[Child 1, name=A1
[Grandchild]
]
[Child 2, name=A2
[Grandchild, name=B2]
]
[Child 3
[Grandchild, name=B3
[Grand-Grandchild]
]
]
]
]
]
\draw (A1) edge (B2)
(A1) edge (B3)
(A2) edge (B3);
\end{forest}
\caption{Mine Editing Tex III}
\label{fig: Causal}
\end{figure}
\end{document}
答案1
如果我理解正确,您可以直接使用no edge
相应锚点的选项,如下面的示例代码修改所示。详细信息请参见第 44-45 页forest
包装文档。 希望这可以帮助。
\documentclass{article}
\usepackage{forest}
\usetikzlibrary{arrows.meta,
shadows}
\tikzset{arr/.style = {draw, -{Stealth[length=2mm]}},
every edge/.style = {arr}
}
\usepackage{lipsum} % for dummy text filler
\begin{document}
\section{Tree}\label{sec6}
\lipsum[66]
\begin{figure}[ht]
\centering
\begin{forest}
for tree={
% nodes
draw, semithick, rounded corners,
fill=green!39, drop shadow,
text width=7em, text centered,
font=\sffamily,
% tree
s sep = 4mm,
l sep = 13mm,
edge = {arr},
}
[Oil Wealth, fill=cyan, sharp corners
[Grandparent
[Parent
[Child 1, name=A1
[Grandchild]
]
[Child 2, name=A2
[Grandchild, name=B2]
]
[Child 3
[Grandchild, name=B3
[Grand-Grandchild]
]
]
[ABC,no edge]
]
]
]
\draw (A1) edge (B2)
(A1) edge (B3)
(A2) edge (B3);
\end{forest}
\caption{Mine Editing Tex III}
\label{fig: Causal}
\end{figure}
\end{document}