Page MenuHomePhabricator

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

Description

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="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\overrightarrow {PQ}}}">
 <semantics>
  <mrow class="MJX-TeXAtom-ORD">
    <mstyle displaystyle="true" scriptlevel="0">
      <mrow class="MJX-TeXAtom-ORD">
        <mover>
          <mrow>
            <mi>P</mi>
            <mi>Q</mi>
          </mrow>
          <mo>→<!-- → --></mo>
        </mover>
      </mrow>
    </mstyle>
  </mrow>
  <annotation encoding="application/x-tex">{\displaystyle {\overrightarrow {PQ}}}</annotation>
 </semantics>
</math></span>
<img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/675febeea8e91072fb11994af206714d0bc598a0" 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 https://en.wikipedia.org/wiki/User:Salix_alba/overrightarrow 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.