1

I'm using the Mathjax Module on drupal 7. All working pretty good but when i'm trying to add the chemistry js, it was not the same !! I tried to enable it without success. I have read a lot of documentation, i forget where but i read : if you use "\ce", mhchem will be loaded automaticly.

Apparently it's not the case :

screen capture

My custom configuration :

MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ['\\(','\\)'] ],
processEscapes: true
},
showProcessingMessages: false,
messageStyle: 'none'
});

Tring to change

extensions: ["tex2jax.js"],

to

extensions: ["tex2jax.js","mhchem.js"],

without success and a lot of other test.

No way to force the js to be loaded. May be there is a trick ?

thanks for helping

1 Answer 1

2

You need to add the mhchem.js extension to another part of your configuration, namely the TeX part.
Here is a configuration that worked correctly for me (a modification of the 'default' custom configuration on a clean Drupal7/MathJax environment:

MathJax.Hub.Config({
  extensions: ['tex2jax.js'],
  jax: ['input/TeX','output/HTML-CSS'],
  TeX: {
    extensions: ['mhchem.js'],
  },
  tex2jax: {
    inlineMath: [ ['$','$'], ['\\(','\\)'] ],
    processEscapes: true,
    processClass: 'tex2jax',
    ignoreClass: 'html'
  },
  showProcessingMessages: false,
  messageStyle: 'none'
});

My content looked like this:

$2 + 2 = 4$

$\ce{H2O}$

and gave me this as an output:

enter image description here Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.