Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

2 Answers

up vote 7 down vote accepted

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}

output of code

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]
{@{\hskip\qtreepadding}#1@{\hskip\qtreepadding}}#3\end{oldtabular}}}}
\def\qroof#1.#2 {{%
\setbox\@qrscratchbox = \hbox{\let\qtreepadding=\qroofpadding
  \qshow@text[l]{\qleafhook}{#1}}%
\def\qtreepadding{0pt}%
\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}
share|improve this answer
    
That works perfectly. Thanks a lot! –  Flávio Cruz Mar 18 '12 at 0:25
add comment

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}

enter image description here

share|improve this answer
    
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
2  
@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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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