Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top of Non-English Characters are clipped #168

Closed
thinkman opened this issue Sep 5, 2011 · 5 comments
Closed

Top of Non-English Characters are clipped #168

thinkman opened this issue Sep 5, 2011 · 5 comments
Labels
Duplicate Expected Behavior This is how MathJax works

Comments

@thinkman
Copy link

thinkman commented Sep 5, 2011

When I use latex

"[\frac{พื้นที่\Delta ABC}{พื้นที่\Delta DEF}]" or

"[\frac{\text{พื้นที่}\Delta ABC}{\text{พื้นที่}\Delta DEF}]" in jsMath,

jsMath displays result as I expect.

But when I try to use Mathjax, Top of Non-English characters are clipped as screenshot below

http://www.mathcenter.net/temp/MathjaxBug01.png
http://www.mathcenter.net/temp/MathjaxBug02.png

@dpvc
Copy link
Member

dpvc commented Sep 6, 2011

The issue here is that the accented characters that you are using are created from a base character with combining diacritical marks. That is, "พื้" is actually a three-character sequence "U+0E1E U+0E37 U+0E49". MathJax treats each of these as a separate character, and tries to make a separate <mi> MathML element out of them. When these are rendered, they are each in a separate <span> element, and in some browsers that prevents the characters from combining (and some browsers don't render the combining character if it appears in a <span> by itself). So the results will be browser (and OS) dependent. For example, the expressions you gave render properly for me in Safari on Mac OS X, but I suspect that you are using Windows, though I can't tell which browser, and I know that IE has problems with this situation.

Your use of \text allows the combining characters to work properly because the characters are all within a single element rather than each in its own element, which is why the MathJaxBug02.png works as expected.

I will see what I can come up with for the future, but for now, the use of \text{} seems like your best approach.

Davide

@dpvc
Copy link
Member

dpvc commented Sep 6, 2011

I forgot to say: the characters aren't clipped. The actual result is that only the base character (the first of the three) is being displayed, because the other two are accents and your browser won't render them if they appear by themselves in their own <span> tag.

@thinkman
Copy link
Author

thinkman commented Sep 6, 2011

Thank you for your support. I tested in Chrome 13 on Windows 7.

The result in MathJaxBug02.png for Mathjax is clipped a little at the top of characters.

I've tried to modify function placeBox to not clip but it works only in Firefox.

Anyway, the use of "\text{}" is a work around solution for me.

@dpvc
Copy link
Member

dpvc commented Sep 6, 2011

Sorry, I didn't see the clipping (I'm not familiary with the characters, and so didn't notice the missing pixels).

The reason is that MathJax doesn't know the dimensions of the character that you are using, and can't readily determine that itself. It assumes the same height as the main font that it is using (which isn't tall enough in this case).

The solution is to add some extra space to the fraction "by hand". Try adding \strut to the numerator and denominator and see if that is enough for you.

\[\frac{\strut\text{พื้นที่}\Delta ABC}{\strut\text{พื้นที่}\Delta DEF}\]

If not, we can define a larger strut.

Davide

@pkra pkra added Duplicate Expected Behavior This is how MathJax works and removed Accepted Issue has been reproduced by MathJax team Address Later labels Mar 4, 2015
@pkra
Copy link
Contributor

pkra commented Mar 4, 2015

Closing this as a duplicate of #474 (even though it should be the other way around, I suppose, but that's where we made progresso n this.) and expected behavior (clipping of unknown characters).

@pkra pkra closed this as completed Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Expected Behavior This is how MathJax works
Projects
None yet
Development

No branches or pull requests

3 participants