My deeply and unevenly nested lists and equations generate a TreeForm image which is too small and compressed to use. Then we must expand it manually by grabbing the edge of the image, and sometimes this requires irritating time and effort, and huge expansions.

Will some clever person please show me how to force the size of the TreeForm image to be large enough that no cells in the image overlap vertically? So no level will vertically overlap any other level?

Then, in some instances, but not as important, a second option to force the image also to be large enough so no two cells on the same level overlap horizontally? (This latter must be an option only, not the default, because the span may be extremely large horizontally for large databases. Also, it might be best that partial overlaps be permitted.)

I imagine running TreeForm with these options, and then being able to use the vertical and horizontal scroll bars to see any part of the nested structure.

This would solve a lot of the problems being addressed by other solutions and questions about TreeForm.

  • $\begingroup$ The Pane idea is promising: If someone knows how to specify vertical display size of a node, say y_Integer. Then use something like Dimension[] to get the number of "levels", say d_Integer. Then specify ImageSize-> 1.2 y d in TreeForm[] in place of ImageSize->1000. (1.2 adds 20% extra vertical space for connecting lines.) I don't know if TreeForm[] can accept a variable in place of the integer 1000, so just ruminating. $\endgroup$
    – GeofAndron
    Jul 16, 2014 at 1:10
  • 1
    $\begingroup$ Hi! I see that you were visiting the site for some time now, but you voted scarcely and you never accepted an answer. Please, when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Nov 16, 2014 at 15:04

1 Answer 1


Try using Pane, e.g. (I used a random chunk of equation for example here):

Pane[TreeForm[(Abs[(mod - q2)*(q1 - lent*totalt)] + Abs[q2*(1 + q1 - lent*totalt)])/totalt, 
     ImageSize -> 1000], 
     ImageSize -> {600, 400}, Scrollbars -> True]

enter image description here

  • $\begingroup$ I don't believe this answers the primary question: how to automatically size to avoid overlapping labels. $\endgroup$
    – Mr.Wizard
    Jul 9, 2014 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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