我目前有以下內容:
\begin{forest}
for tree={
draw,
minimum height=2cm,
anchor=north,
align=center,
child anchor=north
},
[{Size 5}, align=center, name=SS
[{Size 1 \\ Size 2\\ Size 3}]
[{Size 6 \\ Size 9 \\ Size 10}]
]
\end{forest}
\tikz \node[draw,circle, text width=3cm,align=center]{Un-tested shoes: \\ Size 4 \\ Size 5 \\ Size 7 \\ Size 8};
這會產生一棵樹,樹下有一個圓形節點。但是,我想將節點放置在樹的右側。
關於我如何做到這一點有什麼想法嗎?
謝謝。
答案1
不要留下空行(這相當於為 開始一個新段落tikzpicture
):
\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
draw,
minimum height=2cm,
anchor=north,
align=center,
child anchor=north
},
[{Size 5}, align=center, name=SS
[{Size 1 \\ Size 2\\ Size 3}]
[{Size 6 \\ Size 9 \\ Size 10}]
]
\end{forest}\quad
\tikz\node[draw,circle, text width=3cm,align=center]
{Un-tested shoes: \\ Size 4 \\ Size 5 \\ Size 7 \\ Size 8};
\end{document}
但是,您不需要兩個單獨的構造來實現您想要的。您可以為 中的某個節點指派一個名稱forest
,然後使用 synatxat (<name>)
和適當的錨點使用該名稱來放置所需的新元素:
\documentclass{article}
\usepackage{forest}
\begin{document}
\begin{forest}
for tree={
draw,
minimum height=2cm,
anchor=north,
align=center,
child anchor=north
},
[{Size 5}, align=center, name=SS
[{Size 1 \\ Size 2\\ Size 3}]
[{Size 6 \\ Size 9 \\ Size 10},name=aux]
]
\node[draw,circle, text width=3cm,align=center,anchor=south west]
at ([xshift=1cm]aux.east)
{Un-tested shoes: \\ Size 4 \\ Size 5 \\ Size 7 \\ Size 8};
\end{forest}
\end{document}