Button Positioning

Would it be possible to post the algorithm for button positioning? I see an earlier post discussing the issue in relation to graphs

and have a similar problem with two buttons one after another. The first button after a table is placed centrally, but the button after that goes to the left. I’ve placed a hidden unused table between the buttons to get round the adjustment but was wondering if a rethink of the positioning algorithm was needed? I’ve had other button issues in the past so it does feel that there is room for improvement here.