I created a button that temporarily fixes the text alignment bug described here. The code for the button is shown below.
Button["Update",
Do[FrontEndExecute[
FrontEndToken[InputNotebook[], "ToggleDynamicUpdating"]], {2}]]
The gif below illustrates how it works.
I would like to make this better by not using a button at all. Instead, I would like the code to trigger anytime the window size changes which would fix the issue permanently. Seems like something simple but can't figure it out.
Edit 1: I came up with an improvement but still not what I want. I put the following code into my init.m file and now it updates when I move the cursor in the notebook window. Unfortunately, it does not update while I'm changing the size of the window. I have to move the cursor into the notebook for the update the happen.
SetOptions[$FrontEndSession,FrontEndEventActions->{"MouseMoved":>Do[FrontEndExecute[FrontEndToken[InputNotebook[],"ToggleDynamicUpdating"]],{2}],PassEventsDown->True}]
I somehow need to trigger the code when there is a change to CurrentValue[WindowSize]. Any ideas?
Dynamic[Echo@AbsoluteCurrentValue@WindowSize]
to print the current window size every time it is changed (you might need to open the "Messages" window to see the messages). You can of course add any code instead ofEcho[...]
$\endgroup$AbsoluteCurrentValue[WindowSize]
there, the content of theDynamic
will be reevaluated when the window size changes. You should also be able to useNotebookDynamicExpression
instead if you want the evaluation to happen once for the entire notebook $\endgroup$