# [CommonHTML] [Firefox] Anomaly with spacing before and after \text #1718

Closed
opened this issue Mar 12, 2017 · 6 comments

Projects
None yet
3 participants

### cebola2 commented Mar 12, 2017

 The issue can be seen in https://cdi2tp.math.tecnico.ulisboa.pt/texto/10 with Firefox 52 on Linux Mint. This may be very browser, version, OS,..., specific problem. Absent from Firefox 51 on Windows or Firefox 52 on Android. Spacing after the phrase "Existe um caminho unindo" in a displayed formula has disappeared although you can see it on mouseover.

Member

### pkra commented Mar 13, 2017

 Thanks for the report. I see this on FF 51 on Windows 10 actually (and Linux) but not on macOS. I also only see this for the CommonHTML output.

Member

### pkra commented Mar 13, 2017

 For the record, I don't see it with FF's dev channel on Win10, so it might be a browser bug with an upcoming fix.
Member

### dpvc commented Mar 29, 2017

 The issue is not restricted to Firefox. Here's what's going on: because you are using mtextFontInherit:true, MathJax must measure the size of the text so that it knows how much space it takes up. It gets the size in pixels, and must convert that to em's (which is what it uses internally). This is done using the em-size of the font surrounding the math, but this value is determined empirically and so is only an approximation. For a very wide item (like a long string of text), the inaccuracy of the em-size has a noticeable effect on the size that MathJax determines, and so the computed size is somewhat far off from the actual size. The CommonHTML output forces the size of the items it measures to be the computed size (so that if it is off, that doesn't have ripple effects to the sizes of things that surround it). So what you are seeing here is CommonHTML trying to force the long line of text to fit the size it thinks it is rather than the size it actually is. One possible solution might be to have CommonHTML not set the width for items over a certain size, where the inaccuracy in the em-size measurements are magnified to such an extent that it becomes problematic, as in this case. Or a second measurement could be taken after the size is set to see how far off it is (though that would cause an additional reflow performance hit).

### dpvc pushed a commit to dpvc/MathJax that referenced this issue Jul 7, 2017

 Don't force width of large collections of text. Resolves issue mathja… 
…x#1718.
 3d84e67 

Merged

Member

### dpvc commented Jul 7, 2017

 The issue1718 branch of my fork of MathJax works around this.

### dpvc added a commit that referenced this issue Jul 10, 2017

 Merge pull request #1788 from dpvc/issue1718 
Don't force width of large collections of text.  #1718.
 fa475de 
Member

### dpvc commented Jul 10, 2017

 ==> Merged

### dpvc pushed a commit to mathjax/MathJax-test that referenced this issue Jul 15, 2017

 Add test for mathjax/MathJax#1718 
 fdbe6ef 
Member

### dpvc commented Jul 15, 2017

 ==> In testsuite MathMLToDisplay/Presentation/TokenElements/mtext/issue1718.html