我用以下代码制作了这棵树
\begin{forest}
for tree={
rounded corners,
draw,
align=center,
top color=white,
bottom color=blue!20,
},
forked edges,
[a
[$ q_{1}k_{1} $
[$ q_{2}k_{2} $
[$ q_{3}k_{3} $]
[$ \cdots $]
[$ q_{3}k_{3} +(k_{3}-1)$]]
[$ \cdots $]
[$ q_{2}k_{2} +(k_{2}-1)$
[$ q_{3}k_{3} $]
[$ \cdots $]
[$ q_{3}k_{3} +(k_{3}-1)$]
]]
[$ \cdots $]
[$ q_{1}k_{1} +(k_{1}-1)$
[$ q_{2}k_{2} $
[$ q_{3}k_{3} $]
[$ \cdots $]
[$ q_{3}k_{3} +(k_{3}-1)$]]
[$ \cdots $]
[$ q_{2}k_{2} +(k_{2}-1)$
[$ q_{3}k_{3} $]
[$ \cdots $]
[$ q_{3}k_{3} +(k_{3}-1)$]]
]]
\end{forest}
我有两个问题
1- 这棵树不适合我的论文。
2-我怎样才能将带有...的盒子带到中间?
答案1
一种方法是将图旋转 90 度:
(红线表示文本边框)
\documentclass{book}
\usepackage[edges]{forest}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{figure}
\centering
\begin{forest}
for tree={
grow'=0,
draw,
rounded corners,
minimum height=3.4ex, inner sep=3pt,
top color=white,
bottom color=blue!20,
anchor=west,
%
math content,
% edges
forked edge,
s sep=2mm,
l sep=8mm,
fork sep=4mm,
}
%
[a
[q_{1}k_{1}
[q_{2}k_{2}
[q_{3}k_{3}]
[\cdots]
[q_{3}k_{3} +(k_{3}-1)]
]
[\cdots]
[q_{2}k_{2} +(k_{2}-1)
[q_{3}k_{3}]
[\cdots]
[q_{3}k_{3} +(k_{3}-1)]
]
]
[\cdots]
[q_{1}k_{1} +(k_{1}-1)
[q_{2}k_{2}
[q_{3}k_{3}]
[\cdots]
[q_{3}k_{3} +(k_{3}-1)]
]
[\cdots]
[q_{2}k_{2} +(k_{2}-1)
[q_{3}k_{3}]
[\cdots]
[q_{3}k_{3} +(k_{3}-1)]
]
]
]
\end{forest}
\end{figure}
\end{document}