OmarIthawi / arabic-mathjax

Beautiful Arabic Math on all browsers. An extension for MathJax v2.
https://arabicmath.org
MIT License
23 stars 7 forks source link

\transn breaks vertical spacing inside of a square root #19

Closed barillax closed 5 years ago

barillax commented 5 years ago

As shown below, when you put a decimal number into a square root, wrapped in \transn, it displays incorrectly. E.g.: \sqrt{\transn{0.04}}

https://codepen.io/barillax/pen/BvVQBX

Screen Shot 2019-04-01 at 3 22 18 PM

I wonder if the fix for this might be similar to https://github.com/OmarIthawi/arabic-mathjax/pull/16 ?

EDIT: this also happens for \transt{}{} inside of a square root, i.e.: %% \sqrt{{\transt{speed}{السرعة}}} %%

Screen Shot 2019-04-01 at 4 02 10 PM
barillax commented 5 years ago

After looking at #16, I inspected the DOM and found that if I added the .mar class to the surrounding element, it fixed the display. See image below illustrating what I mean:

Screen Shot 2019-04-01 at 3 44 13 PM

The top square root in the above image renders incorrectly, while the bottom one displays properly thanks to the CSS giving the span border-width: 0.45 em 0;

I'm not super familiar with the code, but it kind of looks like the issue here is that when you use one of the \trans* functions, the resulting token(s) don't have arabicFontLang set to ar, which leads to the code in https://github.com/OmarIthawi/arabic-mathjax/blob/master/src/html.js#L51 not being run to add the mar class?

shadinaif commented 5 years ago

@barillax this PR https://github.com/OmarIthawi/arabic-mathjax/pull/20 should solve your issue. Please wait for it to be merged and pushed to npm

CC: @OmarIthawi

barillax commented 5 years ago

Thank you @shadinaif !