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

Arabic RTL: \fbox and \boxed isn't display correctly #42

Open yenntkaopiz opened 1 year ago

yenntkaopiz commented 1 year ago

When i use \fbox and \boxed in my formula, it's seen be not working well. Tex content.

x = 10
 \\
x = \fbox{10}
\\
x = \boxed{10}

Result test at https://arabicmath.org/testcases/ : image Expected: image

OmarIthawi commented 1 year ago

Hey! Welcome to my little repo @yenntkaopiz!!

Thanks for the bug report. May I know where are you using arabic-mathjax?

yenntkaopiz commented 1 year ago

@OmarIthawi Thanks for your reply! I use it for a learning website deployed in egypt. Resource: Vue3, Mathjax version 2.7 + arabic-mathjax (your extention). I would really appreciate if you could fix it soon or show me an alternative way.

OmarIthawi commented 1 year ago

@yenntkaopiz thanks for letting me know.

I think adding fbox and boxed into the following array would fix it:

https://github.com/OmarIthawi/arabic-mathjax/blob/main/src/html.js#L2-L14

Would you mind testing that? Please also add them to the test cases.

I would really appreciate if you could fix it soon or show me an alternative way.

I'll have to ask for a pull request from you, but I'll review it asap.

yenntkaopiz commented 1 year ago

@OmarIthawi Thank for your helping. I will fix it according to your instructions and test again, if there is no problem, I will make a pull request to fix it!

kientkaopiz commented 1 year ago

Hi @OmarIthawi
I added "boxed" to your code, but when I ran it, I encountered an error: "Cannot read properties of undefined (reading 'prototype')."

After reviewing the code, I determined that the error occurred because MathJax.ElementJax.mml does not contain the "boxed" or "fbox" elements. As a result, calling MML["boxed"] returns null and triggers the error.

In my opinion, this error is caused by MathJax's lack of full support for these particular elements. Do you have any ideas on how to address this issue? I believe that having the ability to include equations inside of boxes is crucial in many real-world use cases. image

OmarIthawi commented 1 year ago

@yenntkaopiz good to hear from you.

I think you're right, there's something special about boxed. Perhaps you can take a look at the MathJax source code to learn how boxed is defined.

What about fbox?

kientkaopiz commented 1 year ago

@OmarIthawi
Thanks for your response. fbox also got similar error. I will try to find something in MathJax source code.