1

I made this tree by the following code

enter image description here

    \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}

I have 2 problem

1- the tree is not fitted in my paper.

2- how I can bring boxes with ... into middle?

  • 1
    Thanks for the update! But in order to know whether or not the tree fits into the paper, one will need a complete document that starts with \documentclass so that it is clear how wide the page is. Given what I see here I feel that it is quite likely that you will need landscape mode. – user194703 Dec 23 '19 at 18:21
  • its \documentclass[12pt]{unbthesis} – user9272398 Dec 23 '19 at 18:23
  • 2
    Rather than putting the document class into a comment you should edit the question so that the provided code is a complete minimal working example. That is, the should compile and be as small as possible to demonstrate your problem. This makes it much easier to help you because we can reproduce your actual problem. – Andrew Dec 23 '19 at 18:55
  • In addition to what @Andrew is saying, you may want to provide us with a link of unbthesis.cls which does not seem to be a class that ships with the standard TeX distributions (but I may be wrong). – user194703 Dec 23 '19 at 19:18
  • could we substitute q1k1 with (say) p1 --this would reduce the space taken up-- similar action for the k2-1 could be replaced with -1--and the cdots could be vertical instead of horizontal – js bibra Dec 24 '19 at 0:17
2

One way is to rotate diagram for 90 degree:

enter image description here

(red lines indicate text borders)

\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}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.