mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.22k stars 1.16k forks source link

[CommonHTML] Anomaly caused by accented character inside \text{} #1353

Closed cebola2 closed 8 years ago

cebola2 commented 8 years ago

I have come across an anomaly in MathJax for which I tried to furnish the proverbial minimal example but failed. I can nevertheless furnish a page without apparent problems, indicate the very slight change that will trigger the problem and screenshots of both.

The page is https://cdi2tp.math.tecnico.ulisboa.pt/praticas/3

To see the problematic area expand the last "Solução" by clicking the black triangle to its left. You will see something like this. screenshot at 2016-01-20 21 28 47

If one adds an acute accent to character a in the word contrario in the begin{cases}\end{cases} structure, then one gets what follows.

screenshot at 2016-01-20 21 30 23

My attempts at replicating this in simpler circumstances have failed miserably so far.

pkra commented 8 years ago

Thanks for reporting this.

I see the problem in Chrome and Firefox; it only seems to affect the CommonHTML output. We'll look into it.

dpvc commented 8 years ago

MathJax doesn't know the bounding boxes for characters that are not in the MathJax fonts (like the accented letters), and so it must measure them in order to determine their size. But when an element is in a container with display:none (as contents of the <details> element effectively are), the browser doesn't lay out the content, and returns 0 for any measurement MathJax makes. This means MathJax gets the wrong size for those characters when they are typeset while they are not visible.

The HTML-CSS output jax moves the math to a non-hidden location in this case, but CommonHTML doesn't. Perhaps that should be done here as well.

dpvc commented 8 years ago

The issue1353 branch of my fork of MathJax includes a work-around.

dpvc commented 8 years ago

=> Merged

dpvc commented 8 years ago

=> In test suite

MathMLToDisplay/Characters/issue1353.html