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

how to install this extension on moodle 4.2? #51

Closed MELAS007 closed 9 months ago

MELAS007 commented 11 months ago

Dear,

I would like to know if you could help to tell me how to install this extension on moodle 4.2?

I tried by myself but it doesn't work and don't know what I am missing?

Thank in advance

Screen Shot 2024-01-07 at 09 59 11 Screen Shot 2024-01-07 at 09 59 34 Screen Shot 2024-01-07 at 10 00 32
MELAS007 commented 11 months ago

I think It is solved for arabic language but there is a small issue. Look in below for the sign is not flipping.

any suggestions to make it work.

Screen Shot 2024-01-07 at 11 14 06 Screen Shot 2024-01-07 at 11 16 23
MELAS007 commented 11 months ago

Now, it looks fine ! but some issue with arabic letters...

any suggestions for this.

Screen Shot 2024-01-07 at 12 10 39
OmarIthawi commented 11 months ago

@MELAS007 glad to see you've done progress with the plugin.

I only see the output. Would you mind sharing the input so we can check?

MELAS007 commented 11 months ago

@MELAS007 glad to see you've done progress with the plugin.

I only see the output. Would you mind sharing the input so we can check?

When I write the equation in English letter, it get this:

Screen Shot 2024-01-07 at 16 06 59 Screen Shot 2024-01-07 at 16 07 30

and when I write with the Arabic letter, it shows like this:

Screen Shot 2024-01-07 at 16 08 20 Screen Shot 2024-01-07 at 16 09 32

Reminder : for arabic user will write in arabic and not with english letters.

I hope to get any suggestions for this.

OmarIthawi commented 11 months ago

@MELAS007 What happens if you write \ar{\sqrt{2}}?

You're supposed to write in English and then let the plugin converts it to Arabic.

Also, use the Amiri font for better rendering as seen in https://arabicmath.org/testcases/

MELAS007 commented 11 months ago

@MELAS007 What happens if you write \ar{\sqrt{2}}?

You're supposed to write in English and then let the plugin converts it to Arabic.

Also, use the Amiri font for better rendering as seen in https://arabicmath.org/testcases/

It works fine with number. We need with arabic letters.

Screen Shot 2024-01-07 at 22 46 35 Screen Shot 2024-01-07 at 22 46 54
MELAS007 commented 11 months ago

https://arabicmath.org/testcases/

I tested ( \ar{\tmfrac{x}{y}{z}} ) on the link that you mentioned, You will see it is wrong with letters... it needs to solve because we have many professors will write MATH in arabic letters and not in english letters. I think you know that in arabs countries and in government schools and universities, many professors doesn't know English very well... so they will not understand why they need to write in English in math to appearing in arabic.

MELAS007 commented 11 months ago

Do you know how to add button with code /alwaysar{f} in mathjax for moodle?

OmarIthawi commented 11 months ago

https://arabicmath.org/testcases/

I tested ( \ar{\tmfrac{x}{y}{z}} ) on the link that you mentioned, You will see it is wrong with letters... it needs to solve because we have many professors will write MATH in arabic letters and not in english letters. I think you know that in arabs countries and in government schools and universities, many professors doesn't know English very well... so they will not understand why they need to write in English in math to appearing in arabic.

@MELAS007 this case isn't supported yet in this plugin. I understand what you mean and I think this is something worth supporting in this plugin but it's a big feature that needs to be designed and developed.

Would you mind jumping into a call for discuss the issue?

Please email me at omar at zeitlabs dot com.

MELAS007 commented 11 months ago

Do you know how to add button with code /alwaysar{f} in mathjax for moodle?

any suggestions about this one?

OmarIthawi commented 11 months ago

Do you know how to add button with code /alwaysar{f} in mathjax for moodle?

any suggestions about this one?

I haven't worked with moodle as an engineer, nevertheless I think this is a doable thing to do.

What's the HTML editor in Moodle? Is it TinyMCE?

MELAS007 commented 11 months ago

Do you know how to add button with code /alwaysar{f} in mathjax for moodle?

any suggestions about this one?

Done!

MELAS007 commented 11 months ago

Do you know how to add button with code /alwaysar{f} in mathjax for moodle?

any suggestions about this one?

I haven't worked with moodle as an engineer, nevertheless I think this is a doable thing to do.

What's the HTML editor in Moodle? Is it TinyMCE?

I did it! many thanks for your help! but think about the previous subject.... ;)

OmarIthawi commented 11 months ago

Great to hear that @MELAS007.

but think about the previous subject.... ;)

Supporting Arabic input and Arabic commands is definitely something I'd like to do.

Because this is a non-trivial feature. I propose two options to support this feature:

Regardless of the option, the work will be published as opensource so others can benefit from it.

Please note that MathJax v3 has been released years ago and this plugin only supports MathJax v2, because we don't the resource and funding to develop that. It's worth mentioning that because Moodle might get MathJax v3 support in the future.

MELAS007 commented 10 months ago

Do you know how to add button with code /alwaysar{f} in mathjax for moodle?

done!

MELAS007 commented 10 months ago

Great to hear that @MELAS007.

but think about the previous subject.... ;)

Supporting Arabic input and Arabic commands is definitely something I'd like to do.

Because this is a non-trivial feature. I propose two options to support this feature:

  • I and my colleagues work with your team to understand the requirements and deliver the feature as a paid project. We've done this multiple times already and the work on this plugin has been almost exclusively funded work via our generous sponsors such as https://www.edraak.org/ , https://salalem.com/ and https://pedago.com/.
  • You and your team develop the feature and we can help in review and guidance. This one can probably be free of charge if the code quality is easy to go with and the work happens smoothly and quickly.

Regardless of the option, the work will be published as opensource so others can benefit from it.

Please note that MathJax v3 has been released years ago and this plugin only supports MathJax v2, because we don't the resource and funding to develop that. It's worth mentioning that because Moodle might get MathJax v3 support in the future.

we do not mind to consider paid project but this would be after we sign a contract with our client. Meanwhile we will do some local trials internally and we hope to reach to a solution.

OmarIthawi commented 10 months ago

Great to hear that @MELAS007. You're always welcome to contribute to this repository and I'm happy to review your code.

Are you planning to use MathJax v3? i.e. does Moodle force you to use MathJax v2?

MELAS007 commented 10 months ago

Great to hear that @MELAS007. You're always welcome to contribute to this repository and I'm happy to review your code.

Are you planning to use MathJax v3? i.e. does Moodle force you to use MathJax v2?

I don't know if Moodle can use MathJax V3 but till now I see they use only v2.

OmarIthawi commented 10 months ago

I don't know if Moodle can use MathJax V3 but till now I see they use only v2.

That makes it easier. This plugin only support MathJax v2.

minahaleem commented 9 months ago

may i know how you fixed the initial issue with showing the \ar as red text? i stuck on this issue since couple of hours.

OmarIthawi commented 9 months ago

@MELAS007 would you mind sharing full instructions on how to add this plugin for Moodle? That'll be a great way to close this issue.

Thanks again.

minahaleem commented 9 months ago

Hi,

from my side, i just followed the installation instructions expect the installation of the font

1- Activated the plugin in MathJax - screenshot attached 2- Create a mathematical questions (both \ar and \alwaysbr) - screenshotattached 3- Expected Results, mathematical equations should be displayed in Arabic, actual results -> ar and alwaysar written in red font

Bildschirmfoto 2024-02-21 um 16 51 22 Bildschirmfoto 2024-02-21 um 16 51 47 Bildschirmfoto 2024-02-21 um 16 52 00
MELAS007 commented 9 months ago

Here the solution for moodle!

copy this code in below to your Mathjax configuration:

`MathJax.Ajax.config.path["arabic"] = "https://cdn.rawgit.com/OmarIthawi/arabic-mathjax/v1.2/dist";

MathJax.Hub.Config({ config: ["Accessible.js", "Safe.js"], errorSettings: { message: ["!"] }, skipStartupTypeset: true, messageStyle: "none", TeX: { extensions: ["[arabic]/arabic.js"] }, 'HTML-CSS': { undefinedFamily: 'serif' } }); ` then purge all caches from Development.

I hope that works for you ! Regards,

minahaleem commented 9 months ago

@MELAS007 thank you very much, it worked just fine. i spent many hours playing with scripts and html scripts without any success, your solution worked as a charm

MELAS007 commented 9 months ago

may i know how you fixed the initial issue with showing the \ar as red text? i stuck on this issue since couple of hours.

Did you purge cache from Development ?

OmarIthawi commented 9 months ago

Amazing!! This plugin now supports Moodle :)

Thank you both!

I'm happy to see that.