Page MenuHomePhabricator

Vertical alignment of \overrightarrow with svg rendering
Closed, DeclinedPublicBUG REPORT


steps to reproduce

Add the wikitext <math display="inline">\overrightarrow {PQ}</math> with surronding text and compare with <math display="inline">\overrightarrow {P}</math>

Setting: MathML with SVG or PNG fallback
Browser: Chrome or Firefox

What happens?:

The first expression appears above the baseline and the second is close to correct baseline

image.png (53×266 px, 4 KB)

What should have happened instead?:

Both expressions should be aligned to text baseline.

Event Timeline

Generated HTML

<span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="" alttext="{\displaystyle {\overrightarrow {PQ}}}">
  <mrow class="MJX-TeXAtom-ORD">
    <mstyle displaystyle="true" scriptlevel="0">
      <mrow class="MJX-TeXAtom-ORD">
          <mo>→<!-- → --></mo>
  <annotation encoding="application/x-tex">{\displaystyle {\overrightarrow {PQ}}}</annotation>
<img src="" class="mwe-math-fallback-image-inline" aria-hidden="true" style="vertical-align: -0.671ex; margin-top: -0.4ex; width:3.714ex; height:4.176ex;" alt="{\displaystyle {\overrightarrow {PQ}}}"></span>

Problem seems to be with the vertical-align: -0.671ex attribute of the svg image. I'm pretty sure we have had similar problems before.

I've created a test page with various combinations.

It seems to only occur with \overrightarrow and \overleftarrow, other similar operators like \widehat and \overline are not affected.

It seems to only occur when there is more than one letter, and at least one of which must be a capital.

@SalixAlba with MathML the layout looks good.

Screenshot 2022-05-13 at 17-35-06 User Salix alba_overrightarrow - Wikipedia.png (1×466 px, 77 KB)

As you point out it is a baseline problem. As we rely on MathJax, we either need to update MathJax T237516 or simplify rendering by a generic rendering approach T302628. I have the feeling that T302628 is the way to go as it allows me or anyone that is capable of using PHP to quickly change things and fix problems without relying on special experts that come and leave the Wikimedia organization from time to time. This will not happen ultra-fast but hopefully still in 2022. In combination with Chrome MathML implementation, this seems a very promising thing to eventually make progress after so many years of almost no progress.

Unfortunately, this also means that the baseline problem can't be fixed unless there is a fix in MathJax 2 that can be cherry-picked. I am changing the status of the task to decline to express my realistic expectation that I don't expect that this will be fixed. If anyone has a fix, I am happy to help get it deployed.