Temml icon indicating copy to clipboard operation
Temml copied to clipboard

mhchem arrow length in chromium

Open ermv opened this issue 1 year ago • 6 comments

Hello! mhchem arrow length is too short in Chrome when using STIX. Works fine in Firefox though. It can be reproduced on temml official website with this TeX: \ce{A->B} Is there any workaround?

in Chrome: image

in Firefox: image

ermv avatar Nov 05 '24 16:11 ermv

Is there any workaround?

None that I am aware of, and I've looked pretty hard. Two years ago, I opened an issue in the Chromium bug tracker. There has been no action (that I am aware of) so far.

On my own pages, I ship the Latin Modern font, partly to get better rendering of this feature.

ronkok avatar Nov 05 '24 17:11 ronkok

I found a hack: somehow backwards arrow stretches fine and I can use it and then mirror with css. Steps to reproduce:

  1. TeX : \ce{A <- B}
  2. CSS:
.mirror {
      -moz-transform: scale(-1, 1);
      -webkit-transform: scale(-1, 1);
      -o-transform: scale(-1, 1);
      -ms-transform: scale(-1, 1);
      transform: scale(-1, 1);
    }
  1. Add class to tag with arrow <mo stretchy="true" lspace="0" rspace="0" class="mirror">←</mo>

Works ok in both Firefox and Chrome

ermv avatar Nov 06 '24 11:11 ermv

That's creative!

My first impulse is to not put something like this into the library. It gives a screen reader false information and it would break documents someday in the future when I can use the proper character.

It is food for thought, though. Maybe I can find another workaround if I just work at it some more.

ronkok avatar Nov 06 '24 17:11 ronkok

This is what transform: scaleX(2.5) would look like in chromium. A bit skewed of course. But maybe good enough for some people to avoid the heavy Latin Modern?

Image

Aside: Same "technique" could be used for the delimiters where it looks even better. Not sure how reliable it would be (I guess there could be new issues in combination with other content). On the other hand this only took 5 mins and looks pretty much exactly like STIX

Local font with scaling and some spacing: Image

STIX: Image

elbotho avatar Apr 01 '25 18:04 elbotho

Temml just writes MathML. It does not do layout and does not know how tall or how wide things are. So it does not have the information needed to calculate the n in transform: scaleX(n).

Even if Temml could write a transform, the arrowhead would be deformed. When I was contributing to KaTeX, I put a lot of effort into preventing that deformation.

ronkok avatar Apr 02 '25 21:04 ronkok

I believe that someone is now investigating the MathML spec for note height as well as the general issue of stretchy arrows in Chromium. We have hope for a fix at the browser level.

ronkok avatar Aug 26 '25 17:08 ronkok