MathJax renders SVG output as paths. One effect is that the bounding box from .getBbox() is tightly around the output. For example, the bounding box around a formula that contains only "x" will have less height than around a formula that contains only "X".
This is different to the standard SVG text. Here the bounding box is always the same height independent of the content.
Is there a way to set a SVG rect with the formula that has the same dimensions as the standard box?
(I don't mind that some "taller" formulas will extend beyond this rect.)
I know that the LaTeX command \bbox is supported. But I don't know how to use it to get what I want, since the \bbox's dimensions are relative to the tight SVG MathJax output. But I want a box that has fixed dimensions relative to the text baseline. So adding, for example, a padding did not help.
I can calculate a couple of values from the standard SVG text using .getBbox(). So let's say the full height of the bounding box of a SVG text element is H (to illustrate: this is roughly the height of "Äg") and the height from the baseline to the top is h (to illustrate: this is roughly the height of "Ä").
Here is an illustration of what I have (blue) and the box I want to add to the formula (red):
Any help greatly appreciated!