I am the inventor and author of the LaTeX/mhchem package. You know, the \ce
macro. Last year, I took over MathJax/mhchem from the core MathJax team and reimplemented it to match the original in more details and to add features that were added to LaTeX/mhchem in the meantime.
I am a huge fan of the design principle of desire paths, see how people use \ce
and if a pattern occurs, support it. One example: to get $\mathrm{NO}_x$ one originally had to enter NO_$x$
. But I observed that many people just typed NO_x
, so I changed mhchem.
Chemistry.SE was a great source of test cases. I downloaded the posts and could see how real users use the \ce
command – and also how they misused it. Many fine improvements came from this opportunity (and one or two compromizes as well).
This way, I learned that people type in orbital configurations and things like pH
, K_a
etc. I thought it a good idea to support these as well.
I think, a LaTeX document is different in many aspects from a SE post. In the former, people are used to have a lot of specialized commands (e.g. for bullet lists or quotes), while in the latter most commands are 'implicit' (typing *
or -
for a bullet point, or >
for a quote). Therfore I am quite happy if people here know 'use \ce
for chemical things'. And if the input is unambiguous, I am happy to support it. I wouldn't expect them to learn 4 or 5 chemical commands. This difference between LaTeX and posts, by the way, is one reason that MathJax/mhchem has more features than LaTeX/mhchem (and the other reason is that JavaScript is more suited that LaTeX to do complex string operations).
Because I am not a chemist, I rely on what I can find in Standard documents. But things get more and more tricky, so I asked here at Chemistry.SE, several times. (Thanks!) During the discussions about orbitals and Ka
, I got some comments saying "Don't do it. K_a
and orbitals should not be part of \ce
."
Because I think comments and upvotes are not the best tool to discuss this topic, I create this discussion. Do you think, it is a good thing that $\ce{K_a = \frac{[H3O+][A-]}{[HA]}}$
is rendered as $$\ce{K_a = \frac{[H3O+][A-]}{[HA]}}$$
Or would you say K_a
and \frac
are no chemical entities and should not be part of the \ce
syntax (and, hence, should be K_\mathrm{a} = \frac{\ce{[H3O+][A-]}}{\ce{[HA]}}
instead)? What about orbials, pH
and the like?
Addendum: At the beginning, I thought \frac
should not be part of \ce
, but it was already supported when I took over MathJax/mhchem. I started with fixing some posts here, but realized how tedious it is and that it would be easier to implement this quickly than fixing 200+ further posts (out of 43k). I think the existence of this feature doesn't hurt too much.