Excessive spacing on letters in hat in formula

When I type hat p into LibreOffice Math, it looks great!

But when I use the formula object in LibreOffice Writer with the exact same formula, I get this irritating extra
space: image

Using hat "p" fixes that, but then I lose that nice looking italic math letter font.

I haven’t touched any of the style settings of the formula object either. What’s going on?

What have you done exactly? hat is an operator to attach a circumflex accent-like decoration to a symbol. Consequently there is no space between it and the base symbol. Here is what I get in Math 25.8.3.2: image.

What are your OS name, exact LO version and save format?

If you save other than .odt, the formula language gets converted to the other format and there is a possible risk of error.

I took the liberty to retag your question as math as this seems more a Math issue than Writer.