# How to stop TreeForm from shaking when changing resolution?

Update

(original question below kept as is).

I can reproduce this on version 11.1.1 on windows 7 as well as 11.0.1. (restarted Mathematica). Interesting is that it only shows on 125% resolution. Here is a gif

I am using one monitor, LG monitor, Ultra wide 34" if that makes any difference.

Original question

I like to set resolution of notebook to 125% instead of default 100%. But this causes TreeForm to keep shaking all the time which makes it hard to see.

Is there a way to stop the shaking at higher resolution?

Here is a MWE

s = Expand[5*(Sin[x] y + x)/y + 8]
TreeForm[s]


No shaking when notebook at 100%. But shaking shows up when changing to 125%. Here is a small gif

I used 11.0.1 here, since my 11.1.1 is busy now running and I can't use it for few hrs. Will also try this on 11.1.1 once done.

I also noticed something interesting. If I change expression and remove the +5 at the end, the shaking stops ! So this

s = Expand[5*(Sin[x] y + x)/y ]
TreeForm[s]


Causes no shaking at 125%. But 5*(Sin[x] y + x)/y +5 does (since it is a little wider tree now?). I also noticed if I grab the TreeForm with the mouse and drag it wider the shaking stops ! But this is hard to do each time, as you can see, I had hard time holding it and expanding it using the mouse:

Windows 7, 64 bit. Does this happen on other platforms?

Update:

Tried answer below and only first one causes shaking. Here is gif

• Can not reproduce the problem with V.11.1.1 running under OS X 10.10.2. Jul 8 '17 at 4:24
• @m_goldberg thanks for trying it. This might then be windows specific issue or issue with 11.0.1. Jul 8 '17 at 4:47
• I think so. I have tagged it accordingly. Jul 8 '17 at 4:53
• I'm voting to close this question as off-topic because I and others cannot reproduce the problem the user is experiencing; I suspect it is being caused by some problem local to the OP's system. Jul 8 '17 at 21:52
• This is a real problem on all platforms. TreeForm has a combination of Scaled sizes and Automatic ImageSize which can, in the current system, set up an unstable fixed point computation. The FE then allows that instability to be self-triggering (i.e., something changed, so better compute it again). But the conditions to trigger this have to be exactly so, and due to slightly different font metrics on different platforms, it's typically the case that an example that triggers it on one platform won't trigger it on another. Jul 9 '17 at 5:06

Try the following:

s = Expand[5 (Sin[x] y + x)/y + 8];
RawBoxes @ ToBoxes @ TreeForm[s]


If that also exhibits shaking, then try the following:

RawBoxes @ ToBoxes @ TreeForm[s, PlotRangePadding->0]
RawBoxes @ ToBoxes @ TreeForm[s] /. _Scaled->0
TreeForm[s, VertexLabeling->None]

• Another option which should fix it is to set a fully explicit ImageSize (both vertical and horizontal dimensions). Jul 9 '17 at 5:08
• @JohnFultz Thanks for the hint. Using TreeForm[s, ImageSize -> 300] and now it no longer shakes at 125% resolution. Jul 9 '17 at 5:32
• @Nasser although a specification of a single dimension to ImageSize will definitely fix some problems (might even fix most of them), it's not guaranteed to fix all of them. Which is why I was careful to mention specifying both dimensions explicitly. Jul 9 '17 at 5:41