9

I'm using the qtree package, and I've made a tree that stretches far too much, and as a result, won't fit on the page. Here is my code:

\Tree [.1/1 [.1/2 [.1/3 [.1/4  [.1/5 1/6 2/9 ]   [.2/7 3/11 3/10 ]  ] [.2/5  [.3/8 4/11 7/12 ]   [.3/7 5/12 4/9 ]  ] ] [.2/3 [.3/5  [.4/7 5/9 7/12 ]   [.5/8 8/13 7/11 ]  ] [.3/4  [.5/7 7/10 8/11 ]   [.4/5 7/9 5/6 ]  ] ] ] [.2/1 [.3/2 [.4/3  [.5/4 6/5 9/7 ]   [.7/5 11/8 10/7 ]  ] [.5/3  [.8/5 11/7 13/8 ]   [.7/4 12/7 9/5 ]  ] ] [.3/1 [.5/2  [.7/3 9/4 12/5 ]   [.8/3 12/7 11/4 ]  ] [.4/1  [.7/2 10/3 11/3 ]   [.5/1 9/2 6/1 ]  ] ] ] ]

Is there a way to make lines from each node to the next smaller and spacing between everything smaller?

Thanks

  • 1
    And you should read the manual of qtree. In '6 How do I . . . ? (The qtree FAQ)', the first question 'Make my tree fit in the page?' – Leo Liu Feb 16 '11 at 12:32
9

You might also want to use tikz-qtree for this (syntax is the same):

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{tikz-qtree}
\begin{document}

\begin{tikzpicture}[scale=.5]
\Tree [.1/1 [.1/2 [.1/3 [.1/4  [.1/5 1/6 2/9 ]   [.2/7 3/11 3/10 ]  ] [.2/5  [.3/8 4/11 7/12 ]   [.3/7 5/12 4/9 ]  ] ] [.2/3 [.3/5  [.4/7 5/9 7/12 ]   [.5/8 8/13 7/11 ]  ] [.3/4  [.5/7 7/10 8/11 ]   [.4/5 7/9 5/6 ]  ] ] ] [.2/1 [.3/2 [.4/3  [.5/4 6/5 9/7 ]   [.7/5 11/8 10/7 ]  ] [.5/3  [.8/5 11/7 13/8 ]   [.7/4 12/7 9/5 ]  ] ] [.3/1 [.5/2  [.7/3 9/4 12/5 ]   [.8/3 12/7 11/4 ]  ] [.4/1  [.7/2 10/3 11/3 ]   [.5/1 9/2 6/1 ]  ] ] ] ]
\end{tikzpicture}
\end{document}
  • Much easier with scale factor. Genius! – djhaskin987 Oct 2 '13 at 14:21
3
\documentclass{article}
\usepackage{graphicx,pdflscape}
\usepackage{qtree}

\begin{document}
\noindent
\resizebox{\linewidth}{!}{%
  \Tree [.1/1 [.1/2 [.1/3 [.1/4 [.1/5 1/6 2/9 ] [.2/7 3/11 3/10 ] ] [.2/5 [.3/8 4/11 7/12 ] [.3/7 5/12 4/9 ] ] ] [.2/3 [.3/5 [.4/7 5/9 7/12 ] [.5/8 8/13 7/11 ] ] [.3/4 [.5/7 7/10 8/11 ] [.4/5 7/9 5/6 ] ] ] ] [.2/1 [.3/2 [.4/3 [.5/4 6/5 9/7 ] [.7/5 11/8 10/7 ] ] [.5/3 [.8/5 11/7 13/8 ] [.7/4 12/7 9/5 ] ] ] [.3/1 [.5/2 [.7/3 9/4 12/5 ] [.8/3 12/7 11/4 ] ] [.4/1 [.7/2 10/3 11/3 ] [.5/1 9/2 6/1 ] ] ] ] ]%
}

\begin{landscape}
\thispagestyle{empty}
\hspace*{-0.1\linewidth}\resizebox{1.2\linewidth}{!}{%
  \Tree [.1/1 [.1/2 [.1/3 [.1/4 [.1/5 1/6 2/9 ] [.2/7 3/11 3/10 ] ] [.2/5 [.3/8 4/11 7/12 ] [.3/7 5/12 4/9 ] ] ] [.2/3 [.3/5 [.4/7 5/9 7/12 ] [.5/8 8/13 7/11 ] ] [.3/4 [.5/7 7/10 8/11 ] [.4/5 7/9 5/6 ] ] ] ] [.2/1 [.3/2 [.4/3 [.5/4 6/5 9/7 ] [.7/5 11/8 10/7 ] ] [.5/3 [.8/5 11/7 13/8 ] [.7/4 12/7 9/5 ] ] ] [.3/1 [.5/2 [.7/3 9/4 12/5 ] [.8/3 12/7 11/4 ] ] [.4/1 [.7/2 10/3 11/3 ] [.5/1 9/2 6/1 ] ] ] ] ]%
}
\end{landscape}

\end{document}

Your Answer

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