Math expressión in H5P activities

Hi everybody,

I am creating an interactive book and I need to use math expression in Latex but the task does not display correctly the expression.

I have installed the library in H5P content management, it shows MathDisplay installed (version 1.0.7).

I have installed MathJax 2.7.7. on my server and I have added a code in config.php of my moodle.   

$CFG->core_h5p_library_config = array(
"H5P.MathDisplay" => array(
"renderer" => array(
"mathjax" => array(
"src" => "/mathjax/MathJax.js",
"config" => array(
"extensions" => array("tex2jax.js"),
"jax" => array("input/TeX", "output/HTML-CSS"),
"tex2jax" => array(
// Important, otherwise MathJax will be rendered inside CKEditor
"ignoreClass" => "ckeditor"
),
"messageStyle" => "none"
)
)
)
)
);

 

in src, I have tried these options:

https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js

or 

internal url of the my MathJax installation

 

I can't see the correct math expression using the next code latex:

$$x^2$$

\(x^2)\

\[x^2]\

 

How can I fix  this problem?

Do I do any bad ?

 

thanks you

otacke's picture

Hi!

First of all, your last two examples are not valid LaTeX. The first one should work though.

The configuration that you can set is meant for the H5P plugin for moodle. You are using moodle's custom H5P integration however that was not created by the H5P core team, but by moodle. I am not convinced that setting a custom configuration setup will work the same way here, if at all.

The interesting thing here is that it should work without changing any configuration file given that you provide proper LaTeX.

Please check again with valid LaTeX and report any messages in your browser's development console, the network tab and your PHP error log.

Best,

Oliver 

Hi Oliver, 

I have noticed the next:

If I create the h5p task in the bank content, the math expression is displayed correctly using $$latex$$ delimiters.

If I create using h5p interactive activity (green icon H5P), the math  expression is not displayed.

Other user occurs the reverse: h5p interactive activities are fine and from content bank does not work. 

It's strange

Any idea?

otacke's picture

The answer here is simple. Both H5P integrations have nothing to do with each other. You need to install libraries for both including the Math Display library.

Thanks you Oliver.

I understand you but I don't know when I am using core H5P and when H5P plugin. 

I think to have read that bank content activities are done by core H5P and in adding in a  lesson/topic  are plugin H5P. Is it ok?

I have installed one math display library. I think it is for core. 

Is the another a plugin? Is it in Moodle repository?

It is some difficult to understand for inexpertise people.

Thank you a lot.

 

otacke's picture

Glad you figured it out.

There is an H5P plugin for moodle that was created by the H5P core team and has been around since 2016 if I am not mistaken. Later on, moodle HQ decided to put their own custom integration into moodle's core leading to the confusing situation that we have today - now that there are two solutions for the same thing that have nothing to do with each other.

Hi

I want to inform that I have solved this problem. Thanks everybody.