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 was trying to find out if I can use tikzscale to scale the tikz-qtree figure in Text tree using tikz-qtree is too wide, don't know how to break lines and make the tree compact to fit in \linewidth. Unfortunately, instead of getting a scaled figure, I get a picture of code snippet in my mygraph.tikz.


Here is an MWE:





And here is mytree.tikz

    [.B ]
     [.D  ]
     [.E  ]]]
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

This is MMM's answer. He has already uploaded the patched tikzscale package to ctan. I will open a bounty later, in his answer that led to this package, to express my appreciation to MMM's work on this package and his speedy reply. It was a little late in posting this but I hope that you can still benefit from the information here.

MMM's answer

Don't you get the correct tree as output at all? When using a slightly adapted size (otherwise the height of the tree is too large to fit on a page) like in


I get the attached output file, which is the correct tree, I think. If you do not get this output, please use the attached sty-file* and a recent development variant of TikZ/PGF.

* Download the patched package in ctan instead

Although the tree is correct, the size of the nodes (with the meaning of edges and nodes, i.e. graph speech) is very large, which is, what tikzscale wants to avoid normally. tikzscale normally uses the tikzpicture's scale option to iteratively converge to the correct size as in \begin{tikzpicture}[scale=4].

This works, as TikZ/PGF defines, that scaling does not scale nodes (with the meaning of coordinates and nodes, i.e. TikZ speech). Unfortunately, the tikz-qtree package seems to ignore that definition. I am not sure, if that was done on purpose (I've CC'ed its author), but I do not think that tikzscale can do much as long as tikz-qtree does this scaling.

Did you have a look at the graph chapter in a recent development version of TikZ/PGF? I think these graphs behave correctly regarding scaling, which basically means, that they are unscalable at the moment.

You can try using code like the following

       % This is not commutative, as there is an error on commutation!
       \pgfmathsetlength{\parts}{\textwidth * \tikzscale@scale}%

to get a dynamically sized variable \parts, which can be used to set the node distance or something like that, to get a graphic which is scalable with tikzscale, but this is all not officially supported, yet. Nevertheless, I would be interested to hear about use cases.

About the tikz-qtree

The author has expressed interest in fixing the scale implementation as suggested by MMM.

share|improve this answer
add comment

Your Answer


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.