0

I have used the qtree package to write the following tree:

\Tree[.F    [.F[0]  [.F[0][0] {[x, y, z]} ]
                        [.F[0][1] {[x, y, z]} ]
                        {\ldots}
                        [.F[0][m-1] {[x, y, z]} ]]
                [.F[1] {\ldots} ]
                {\ldots}
                [.F[n-1] {\ldots} ]]

which gives this: enter image description here

However, when I added another subtree to F[n-1], the tree went over the margin. How can I reduce the space between the nodes under F to avoid this: enter image description here

3
  • 1
    Please extend your code fragment to complete small, compilable document. We need to know how much space there is on the page for the picture of the tree.
    – Zarko
    Aug 23, 2020 at 17:22
  • Are you using qtree or tikz-qtree? They are very different packages.
    – Alan Munn
    Aug 23, 2020 at 18:13
  • 1
    I was using qtree but have changed to forest following Zarko's suggestion
    – evamen
    Aug 23, 2020 at 18:26

1 Answer 1

2

With using package forest, you can easily adjust the distances between tree's nodes:

\documentclass{article}
\usepackage{geometry}
\usepackage{forest}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
    \begin{center}
\begin{forest}
  for tree = {font=\small,
              s sep=1mm,  % <---
              l sep=3mm   % <--- 
              }
%
[F    
    [{F[0]},fit=band  
        [{F[0][0]}
            [{[x, y, z]}]
        ]
        [{F[0][1]} 
            [{[x, y, z]}]
        ]
        [\ldots]
        [{F[0][m-1]} 
            [{[x, y, z]} ]
        ]
    ]
    [{F[1]},fit=band 
        [{\ldots}]
    ]
    [\ldots]
    [{F[n-1]},fit=band
        [{F[n-1][0]}
            [{[x, y, z]}]
        ]
        [{F[n-1][1]}
            [{[x, y, z]}]
        ]
        [\ldots]
        [{F[n-1][m-1]}
            [{[x, y, z]} ]
        ]
    ]
]
\end{forest}
    \end{center}
\end{document}

enter image description here

(red lines present text borders)

1
  • 1
    Many thanks for the help!
    – evamen
    Aug 23, 2020 at 18:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .