나무를 더 넓게 만드는 방법?

나무를 더 넓게 만드는 방법?

여기에 이미지 설명을 입력하세요

이것은 다음 코드로 만든 트리입니다.

\begin{tikzpicture}[sibling distance=7em,
  every node/.style = {shape=rectangle, rounded corners,
    draw,
    top color=white, bottom color=blue!20}]]
  \node {$ C_{i} $}
    child { node {$ q_{1}k_{1} $} 
    child{node{$q_{2}k_{2} $}}
     child{node{$\cdots$}}
         child{node{$q_{2}k_{2}+(k_{2}-1) $}}}
    child { node {$ \cdots$} }
    child { node {$ q_{1}k_{1} +(k_{1}-1)$} 
    child{node{$q_{2}k_{2} $}}
     child{node{$\cdots$}}
         child{node{$q_{2}k_{2}+(k_{2}-1) $}}}
;
\end{tikzpicture}

두 가지 가지가 무너지는 것을 볼 수 있듯이 나무를 더 넓게 만들어 더 멋지게 만들고 싶습니다.

답변1

로 전환하고 싶을 수도 있다는 Alan Munn의 의견에 동의합니다 forest. 다음은 일부 옵션을 설명할 수 있는 두 가지 변형입니다.

\documentclass{article}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
for tree={shape=rectangle, rounded corners,calign=child,calign primary child=2,
    draw, top color=white, bottom color=blue!20,math content}
[C_{i}
 [q_{1}k_{1}
  [q_{2}k_{2}]
  [\cdots]
  [{q_{2}k_{2}+(k_{2}-1)}]
 ] 
 [\cdots[,phantom]]
 [{q_{2}k_{2}+(k_{2}-1)}
  [q_{2}k_{2}]
  [\cdots]
  [{q_{2}k_{2}+(k_{2}-1)}]
 ] 
]   
\end{forest}

or 

\tikzset{cbox/.style={shape=rectangle, rounded corners,
    draw, top color=white, bottom color=blue!20},
    none/.style={draw=none,shade=none},
    Dotted/.style={% https://tex.stackexchange.com/a/52856/194703
    dash pattern=on 0.1pt off 2mm,line cap=round,line width = 2pt,
    shorten <=2.5mm,shorten >=2.5mm}}
\begin{forest}
for tree={math content,calign=child,calign primary child=2,cbox}
[C_{i}
 [q_{1}k_{1},alias=left1
  [q_{2}k_{2},alias=left2]
  [,phantom]
  [{q_{2}k_{2}+(k_{2}-1)},alias=right2]
 ] 
 [,phantom[,phantom]]
 [{q_{2}k_{2}+(k_{2}-1)},alias=right1
  [{q_{2}k_{2}+(k_{2}-1)},alias=left3]
  [,phantom]
  [q_{2}k_{2},alias=right3]
 ] 
]   
\foreach \X in {1,2,3}  {\draw[Dotted](left\X.east) -- (right\X.west);}
\end{forest}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보