为了解释“概率”树,我想添加额外的文本。我想将所有这些额外的文本垂直对齐。这可行吗?
节点和其额外内容之间是否也能有完美的基线对齐?
该包是否forest
为树的节点提供了易于使用的名称?
\documentclass[12pt]{article}
\RequirePackage{forest}
\useforestlibrary{linguistics}
\forestset{
extra/.style={
edge label={
node [xshift=1.5cm] {$\leftarrow$ #1}
}
}
}
\begin{document}
\begin{forest}
for tree = {%
sn edges,
grow' = 0,
anchor = parent,
},
[
[A
[B, extra=b]
[C, extra=c]
]
[D
[E, extra=e]
[F
[G, extra=g]
[H, extra=h]
]
]
]
\end{forest}
\end{document}
答案1
指向正确方向的指针——而不是像森林树extra style
那样write me style
定义——向内的指向箭头可以(稍后)进行修改,以适应从到 的bounding box
长度——tagZ
nodeB
https://tex.stackexchange.com/a/398722/197451
\documentclass[12pt]{article}
\RequirePackage{forest}
\useforestlibrary{linguistics}
\forestset{
extra/.style={
edge label={
node [xshift=1.5cm] {$\leftarrow$ #1}
}
}
}
\begin{document}
\begin{forest}
for tree = {%
sn edges,
grow' = 0,
anchor = parent,
},
write me/.style={
tikz+={
\node [anchor=mid west, red] at (.mid -| write me coord) {$\leftarrow$ #1};
},
},
tikz+={
\coordinate (write me coord) at (current bounding box.east);
}
[
[A
[B, write me=tag Z]
[C, extra=c]
]
[D
[E, extra=e]
[F
[G, extra=g]
[H, write me=tag T]
]
]
]
\end{forest}
\end{document}