![森林 - 精确垂直调整额外附加节点的文本](https://linux22.com/image/464709/%E6%A3%AE%E6%9E%97%20-%20%E7%B2%BE%E7%A1%AE%E5%9E%82%E7%9B%B4%E8%B0%83%E6%95%B4%E9%A2%9D%E5%A4%96%E9%99%84%E5%8A%A0%E8%8A%82%E7%82%B9%E7%9A%84%E6%96%87%E6%9C%AC.png)
我想调整上图中时间符号的垂直位置。
这是使用的代码。
\documentclass[12pt]{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree = {math content},
where n children = 0 {tier = word} {}
[243
[3 [3^1]]
[81
[9 [3^2]]
[9 [3^2]]
]
]
\path (!11) -- (!211) node[midway]{$\times$};
\path (!211) -- (!221) node[midway]{$\times$};
\end{forest}
But we must have :
$3^1 \times 3^2 \times 3^2$
\end{document}
答案1
一种可能的解决方案是使用base
锚点。例如:
\documentclass[12pt]{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree = {math content},
where n children = 0 {tier = word} {}
[343
[3 [3^1]]
[81
[9 [3^2]]
[9 [3^2]]
]
]
\path (!11.base) -- (!211.base) node[midway,anchor=base]{$\times$};
\path (!211.base) -- (!221.base) node[midway,anchor=base]{$\times$};
\end{forest}
But we must have:
$3^1 \times 3^2 \times 3^2$
\end{document}