I am working on a chemistry project, and i'm trying to make a site that will show the needed equations, i have installed MathJax and mhchem, but the \ce command is not being processed and the output looks like this:
Where the input is: \ce{H2O + HCl <=> H3O+ + Cl-}
The MathJax config and connection to the site is the following:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
TeX: {
extensions: ["[Contrib]/mhchem/mhchem.js"]
}
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML"></script>
The problem was in the way i passed the argument to the function which was updating the displayed expression, where i was not escaping the backslash:
UpdateMath('\ce{H2O + HCl <=> H3O+ + Cl-}');
Where the correct expression would be:
UpdateMath('\\ce{H2O + HCl <=> H3O+ + Cl-}');