fast-reflexes / better-react-mathjax

MIT License
124 stars 16 forks source link

Display chemical formulae using the mhchem extension? #25

Closed austinbooth closed 2 years ago

austinbooth commented 2 years ago

Hi, is it possible to use the mhchem extension to display chemical formulae etc?

fast-reflexes commented 2 years ago

Thanks for your question!

Everything that can be done in MathJax can be done with better-react-mathjax. MathJax supports the math extension of MathJax and a subset of other features / packages. Nonetheless, everything that can be done in Latex can NOT be done in MathJax.

However, it looks like the mhchem extension is supported (like you linked to yourself): https://docs.mathjax.org/en/latest/input/tex/extensions/mhchem.html

I don't know if this extension in Latex supports more macros than are available in MathJax, but at least some of them are. Note that Latex extensions that are available in MathJax are entirely rewritten from their Latex counterparts.

Here is a sandbox: https://codesandbox.io/s/better-react-mathjax-25-hxcekd I just grabbed a mhchem expression from https://docs.moodle.org/400/en/Chemistry_notation_using_mhchem.

Hope that's what you want!

austinbooth commented 2 years ago

Yes that's perfect, thanks!