[Tex/LaTex] Why does \widehat behave differently if I insert \hspace{0pt}


I am getting some inexplicable behaviour from \widehat:



Notice that the hat is misaligned in the first instance, but correctly aligned in all the other instances. Why does \hspace{0pt} make such a difference?

Also, how can I replicate this effect for other alignment problems? At the moment I am having trouble with the bounding boxes for the script font I am using…

Best Answer

If you put an accent over a single character, TeX uses information in the font metrics to shift the accent to take some account of the slope of the italic letters. Which is why the first one shifts. If you put an accent over a more complicated math list then it's just centered over the list.

Related Question