Chemical formulas in H5P/Moodle

Hello, 

I use to write chemical formulas and equations on Moodle using mhchem package of MathJax. It works great. Recently I was introduced to H5P and find it amazing. The problem now is that H5P does not recognize my Latex formulas that I used to write on Moodle. Example: I am trying to use

*2*  \(\ce{Mn^2+}\) + *4*  \(\ce{MnO4^-}\) + *6*  \(\ce{H2O}\)   \(\ce{->}\)  *8* \(\ce{MnO2}\) + *10*  \(\ce{H^+}\)

on a "fill in the blank" exercice but it does not recognize my chemical equation.

Can anyone help me.

 

Thank you very much

Summary: 
chemical equations
Content types: 
otacke's picture

Hi rcambrosio!

On your own server, you can customize the MathDisplay library as described at https://h5p.org/mathematical-expressions - and it seems all you have to do is to add the \ce command, see https://mhchem.github.io/MathJax-mhchem/

Best,

Oliver 

Hello Oliver,

thanks for your help.

I still successfully use mhchem for MathJax inside Moodle. The problem is that the mhchem comands are not recognized inside H5M that I use in the same Moodle instalation. I apologize for my illiteracy on the subject, I dont't know how ho habilitate the mhchem on H5M. I downloaded the library on the link you sent and uploaded to Moodle but it istill dont work.

In my moodle instalation, on plugin filters I use:

MathJax.Ajax.config.path["mhchem"] =

  "https://cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.3.2";

 

MathJax.Hub.Config({

tex2jax: {

    inlineMath: [['$','$'], ['\\(','\\)']],

    processEscapes: true

  },

  TeX: {

    Macros: {

      sen: "{\\operatorname{sen}}",

      senh: "{\\operatorname{senh}}",

      arcsen: "{\\operatorname{arcsen}}",

      arcsenh: "{\\operatorname{arcsenh}}",

      arccos: "{\\operatorname{arccos}}",

      arccosh: "{\\operatorname{arccosh}}",

      arctg: "{\\operatorname{arctg}}",

      arctgh: "{\\operatorname{arctgh}}",

      cossec: "{\\operatorname{cossec}}",

      cossech: "{\\operatorname{cossech}}",

      sech: "{\\operatorname{sech}}",

      tg: "{\\operatorname{tg}}",

      tgh: "{\\operatorname{tgh}}",

      cotg: "{\\operatorname{cotg}}",

      cotgh: "{\\operatorname{cotgh}}",

      arcsec: "{\\operatorname{arcsec}}",

      dist: "{\\operatorname{dist}}",

      mdc: "{\\operatorname{mdc}}",

      mmc: "{\\operatorname{mmc}}",

      C: "{\\mathbb{C}}",

      R: "{\\mathbb{R}}",

      Q: "{\\mathbb{Q}}",

      Z: "{\\mathbb{Z}}",

      N: "{\\mathbb{N}}"

    },

    extensions: ["[mhchem]/mhchem.js"]

  },

    config: ["Accessible.js", "Safe.js"],

    errorSettings: { message: ["!"] },

    skipStartupTypeset: true,

    messageStyle: "none"

});

 

MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {

  MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{

    cancel: ["Extension","cancel"],

    bcancel: ["Extension","cancel"],

    xcancel: ["Extension","cancel"],

    cancelto: ["Extension","cancel"]

  });

});

otacke's picture

Hi!

I am sorry, but I fear I can't tell you anything that's not already described on the two pages that I linked to.

Best,

Oliver 

Jalmer's picture

I got the same trouble, but by using \require{mhchem}\ce{...} it is working. Just needed once inside a H5P-file.