Forum

Enable chemistry expressions in items (on Windows 10)

I would like to enable the latex library mhchem, for formatting chemical equations and physical units, in MathJax in TAO. I have been unable to succeed in this. If anyone can help with this, I would greatly appreciate it. I'm writing below the things I have figured out and attempted, already. If someone can help me figure out the rest, I would try to update some of the documentation pages.

I needed to first enable math expressions in items:
* The article "Enable math expressions in items" has a broken link and is out of date for the most recent releases of MathJax.
* The process in this discussion worked, but it is 3-4 years old. There have been updates to MathJax since then, and I can't tell if this mathjax-shrunk is the most up to date. It does not appear to have the same file structure as the current version of MathJax.

After enabling math expressions in items, I tried to enable mhchem. I did the following things:
* I downloaded mhchem.js and copied it to C:\xampp\htdocs\taoQtiItem\views\js\mathjax\extensions.
* I changed the config (C:\xampp\htdocs\taoQtiItem\views\js\mathjax\config\TeX-AMS-MML_HTMLorMML-ful.js) file to include:

MathJax.Ajax.config.path["mhchem"] =
"https://cdnjs.cloudflare.com/ajax/libs/mathjax-mhchem/3.3.2";
MathJax.Hub.Config({
TeX: {
extensions: ["[mhchem]/mhchem.js"]
}
});

as per the github mhchem page.

Alternatively, I copied mhchem.js to:
* C:\xampp\htdocs\taoQtiItem\views\js\mathjax\extensions\ and added "[MathJax]/extensions/mhchem.js" to the config file
or
* C:\xampp\htdocs\taoQtiItem\views\js\mathjax\extensions\TeX\ and added "[MathJax]/extensions/TeX/mhchem.js" to the config file
or
* C:\xampp\htdocs\taoQtiItem\views\js\mathjax\extensions\MathML\ and added "[MathJax]/extensions/MathML/mhchem.js" to the config file

This page has some instructions on loading mhchem within MathJax, but I can't figure out how it applies, especially since the mathjax-shrunk is not the same as MathJax that is up to date according to the instructions on the nodejs extensions page.

Comments

  • I also tried installing NodeJS and npm, and then installing mathjax.js with npm. I then copied the es5 folder into the mathjax folder, but that didn't enable mathjax within TAO. If I had been able to include mathjax through adding the es5 folder, then instructions exist for including mhchem in mathjax. The instructions don't transfer to including it with mathjax-shrunk, that worked to get mathjax working in TAO.

Sign In or Register to comment.

We use cookies on our website to support technical features that enhance your user experience. Cookie Policy Privacy Policy

×