# Making node's fonts larger when using the qtree package

I'm using the qtree package in LaTeX, but the tree nodes have very small text. I'm also using \scalebox to scale down the tree since it does not fit in the page.

Is there a way to increase the size of the text while keeping the tree small? I tried qtreeinithook with \Large but without any luck, since the text is still not big enough.

Edit: so, the problem is related to the template I'm using from here ftp://ftp.cup.cam.ac.uk/pub/texarchive/journals/latex/tlp-cls/unpacked/tlp.cls

    \documentclass[conference]{tlp}
\usepackage{qtree}
\begin{document}
\Tree [.A [ a b c d ].B !\qsetw{1cm} C ]
\newcommand\qlabelhook{\Huge}
\newcommand\qleafhook{\Huge}
\Tree [.A [ a b c d ].B !\qsetw{1cm} C ]
\end{document}


With this code, the edges of the tree get so big that the tree does not fit in the page. I guess the problem is with the template.

-
Welcome to TeX.sx! A tip: You can use backticks  to mark your inline code as I did in my edit. –  doncherry Mar 17 '12 at 22:57

The problem is caused by the fact that the tlp class redefines the tabular environment, which is used internally by qtree. I've given a fix at the end but there's a simpler solution.

You can use use tikz-qtree instead of qtree. The syntax is the same, although certain commands like \qsetw and \qroof are not supported (the former isn't needed, and the latter has an alternative syntax). tikz-qtree doesn't seem to have the same issues with the class you're using:

\documentclass[conference]{tlp}
\usepackage{tikz-qtree,tikz-qtree-compat}
\begin{document}
\begin{tikzpicture}[every tree node/.style={font=\Large,anchor=base}]
\Tree [.A [ a b c d ].B  C ]
\end{tikzpicture}
\end{document}


Solving the problem with qtree

If you still need to use qtree you can add the following to your preamble, and then Gonzalo's solution works, but the first solution is clearly preferable.

\documentclass[conference]{tlp}
\usepackage{qtree}
\makeatletter
\renewcommand{\qshow@text}[3][c]{{#2{\begin{oldtabular}[t]
\def\qroof#1.#2 {{%
\qshow@text[l]{\qleafhook}{#1}}%
\begin{oldtabular}{@{}c@{}}
\setbox\@tempboxa = \hbox{\qshow@text{\qlabelhook}{#2}}%
\ifdim\wd\@tempboxa>0pt \box\@tempboxa \\ \fi
\unitlength=\wd\@qrscratchbox \qdraw@roof \\[-0.6ex]
\box\@qrscratchbox
\end{oldtabular}}}
\makeatother
\begin{document}
\Tree [.A [ a b c d ].B  C ]
\newcommand\qlabelhook{\Huge}
\newcommand\qleafhook{\Huge}
\Tree [.A [ a b c d ].B !\qsetw{1cm} C ]

\end{document}

-
That works perfectly. Thanks a lot! –  Flávio Cruz Mar 18 '12 at 0:25

You can use \qleafhook (for the leaves) and \qlabelhook (for non-terminal nodes):

\documentclass{article}
\usepackage{qtree}

\begin{document}

\Tree [.A [ a b c d ].B !\qsetw{1cm} C ]

\newcommand\qlabelhook{\Huge}
\newcommand\qleafhook{\Huge}

\Tree [.A [ a b c d ].B !\qsetw{1cm} C ]

\end{document}
`

-
I tried your code and it works, but somehow the template I am using messes up with everything and makes the edges of the tree huge. –  Flávio Cruz Mar 17 '12 at 23:36
@FlávioCruz: without some version of your actual code, it's almost impossible to detect the cause of the problem. If you want to, you can edit your question to add a minimal, complete version of your code illustrating the problem. –  Gonzalo Medina Mar 17 '12 at 23:43