questions about how add the mathjax script inside the iframe.

Aloulou00763's picture

hello , Can you give details how to add the mathjax script inside the iframe. and i use wordpress ? wish you answer me soon thanks ? 

Summary: 
Mathjax library for h5p
Issue Status: 
tomaj's picture

Hi,

Have you seen this thread? There is some talk on mathjax there.

@all Is there anyone in the community that has successfully integrated matchjax in the editor in h5p?

- Tom

Aloulou00763's picture

thanks but i need some clear documentation helps me to add mathjax in h5p 

icc's picture

Hi! Unfortunately, there's no drop-in way of doing it, but you should be able to add it through a custom plugin or theme using the instructions described in the comments here.

Aloulou00763's picture

 in the comments here. they talk about drupal , is a way to more explain how to do the same in wordpress please it's so urgently 

icc's picture

The same principals apply for WordPress, only you have to register the 'hook' with an action, an example can be found here under the WordPress section. There's also a link to a custom plugin illustration how to add extra JavaScripts to the H5P. 

Aloulou00763's picture

Thank you , really that what i need at the moment 

tomaj's picture

I think the community would be very interrested to know about a solution to this, if you are able to succeed.

Good luck! :)

- Tom

Aloulou00763's picture

thank you

Hi were you able to make it work? I am also having the same problem. Thanks

serettig's picture

I've started work on adding mathjax to h5p by creating a library. Of course, having a library means that content types specifically have to reference it for mathjax to work. This has the advantage that there might be content types which absolutely have no use for mathemtical expressions, but also the disadvantage that many libraries would have to include the reference (and probably an initialization call).

So which approach does the h5p team favour? Would you be willing to put this into every applicable content type?

 

fnoks's picture

Hi,

There are plans to support mathematical expressions in the H5P core, so adding a dependency to a library on many of the libraries is probably something we shouldn't do. Also: I don't see how it is possible to achieve this using H5P libraries? Wouldn't you have to do something with semantics to allow for math tags or similar?

serettig's picture

Hi,

I agree that the best way certainly is to have mathematical expression support in the core! If there are concrete plans that will lead to support within a year or so, I'm not going to pursue this.

It is possible to this this in a library if the library is either passed an html node to pass to MathJax or if the library initializes MathJax for the whole iframe.

I've done this in a proof-of-concept library. Have a look at the example in an interactive video and in a simple multiple-choice h5p. It works in general but is far from complete, as there are issues with slow progressive rendering of the formulas and the application of MathJax rendering to elements that were changed in the DOM is not complete yet. 

As I've added MathJax to H5P.Question, there is no way to switch it off in a content type if the author doesn't want this. I'm not entirely happy with this, but it seems like the quickest way to get maths support for our maths faculty without changing too much of the h5p core.

fnoks's picture

Hi,

What we imagine is a Math-button on all wysiwyg fields. When clicking this, you will get a simple math editor popup, that probably takes latex as input, but renders it while you type. When closing the popup, the expression should be rendered inside the wysiwyg.

We are working on getting sponsors for this feature, and it would really surprise me if this wasn't available within a year. Let me know if you would be interested in being a sponsor.

As part of the H5P conference, I had a session where I created a proof-of-concept for how to add math-support to the wysiwyg without changing core or touching the libraries. This is implemented as a separate Drupal module that utilizes the different hooks H5P offers. It is available here: https://github.com/fnoks/h5p_math. This implementation has a few problems, e.g. currently I don't think editing an existing expression works. There are probably other problems as well. The most important aspect of this approach is that it does not require any change of existing code.

-- fnoks

 

I would love to see this in H5P and would be interested in contributing (either through coding help or sponsorship).  I would nominate MathQuill for the editor (MPL 2.0 license).  I looked at trying to implement a Moodle plugin but it seems inefficient to keep implementing CMS/LMS specific implementations.  It seems like with MathJax and MathQuill all the pieces are here in JavaScript.  

falcon's picture

Hi @scotru, we're considering an approach where various input methods may be used for authors (LaTeX and WIRIS are the most relevant initial candidates), and MathJax to render the view. MathQuill could also be an alternative input method for authors as it seems to be able to store the formula as LaTeX. We're indeed looking for funding to get make this happen. If you could help fund it please reach out using the contact form.