4

I'm looking for a way to make the main font bigger than the default size (just biiiiig all the way). I'm a total LateX noob and already tried and failed anything I found online. (e.g. the posts already asking this question about tikz-qtree, which I have no idea what it is)

Here's my body:

\documentclass{article}
\usepackage{qtree}
\\begin{document}
\Tree  [here goes my nice tree blablablalballalb]
\end{document}

2 Answers 2

5

The qtree package allows you to define two hooks for formatting the labels and the leaf nodes of the tree. They are \qlabelhook and \qleafhook.

\documentclass{article}
\usepackage{qtree}
\newcommand{\qlabelhook}{\Large}
\newcommand{\qleafhook}{\Large\itshape}
\begin{document}

\Tree  [.AP [.XP X ] [.BP [.CP C ] [.D D ] ]]

\end{document}

qtree tree

However, if you are new to LaTeX I would not recommend using qtree. It is an old package that has largely been superseded by either tikz-qtree or the even more powerful forest package. I would recommend using the latter. Here's the same tree using forest. Notice the slight change in the syntax (there is no . in labels, and leaf nodes also need to be bracketed.)

\documentclass{article}
\usepackage[linguistics]{forest}

\begin{document}

\begin{forest}for tree={font=\Large}, for leaves={font=\Large\itshape}
[AP [XP [X] ] [BP [CP [C] ] [D [D] ]]]
\end{forest}

\end{document}

forest tree

2

Qtree doesn't set the font size unless you tell it to. If you want the entire tree to be in a larger (or smaller) size, just switch the font size before beginning the tree:

\documentclass{article}
\usepackage{qtree}
\\begin{document}
{\Large
\Tree  [here [.VP goes [.NP my nice tree ] blablablalballalb ] ]
\par}
\end{document}

Better yet, you can use LaTeX environment syntax instead of TeX brackets:

\begin{Large}
\Tree  [here [.VP goes [.NP my nice tree ] blablablalballalb ] ]
\end{Large}

If in fact you want to control the font size of selected parts of the tree, use the formatting hooks \qlabelhook and \qleafhook as Alan Munn shows in his answer. (Or use a different tree package, as he also suggests.)

4
  • 1
    I tried this initially but it creates odd vertical spacing issues compared to the \qlabelhook solution.
    – Alan Munn
    Commented Feb 7, 2017 at 11:26
  • Hmm, I wasn't aware of that, thanks. I didn't try this code today, but it's my standard solution when a tree needs to be smaller... I'll have to look into it, perhaps it only works well for smaller sizes.
    – alexis
    Commented Feb 7, 2017 at 20:15
  • It is certainly not better yet to treat a switch as an environment. This will work, but it is misleading because there is no environment here. \Large is a switch. Better by far to treat it as such in your code rather than obscuring its kind to no purpose.
    – cfr
    Commented Feb 17, 2017 at 2:19
  • @cfr, I guess it is a question of taste, but I'll raise you this SO question and the first comment to the (well-upvoted) accepted answer, which points out that using switches as environments is endorsed in Leslie Lamport's book. Despite the caveats (idem.), I consider the environment syntax to be more in the spirit of latex style than the TeX {\switch ...} syntax.
    – alexis
    Commented Feb 17, 2017 at 11:40

You must log in to answer this question.

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