I'm still new to this stack community and getting used with the formatting. I've read the article about this matter and while it explains that mhchem is supported and shows examples but only offer this documentation but I was wondering if there are more examples in a more extended source.

I'm interested into displaying let's say reaction mechanisms, BCE tables or Hess law equations. Can somebody help me with these?.

  • 1
    $\begingroup$ Could you please add examples (screenshots or references to look up) for the desired representations for "reaction mechanisms, BCE tables or Hess law equations"? In this case we could try to assist you using certain examples. $\endgroup$ – andselisk Nov 30 '19 at 5:53
  • 2
    $\begingroup$ mhchem is rarely used alone, in most cases general MathJax markup is applied alongside. Probably you find a more comprehensive MathJax basic tutorial and quick reference helpful. $\endgroup$ – andselisk Nov 30 '19 at 5:53

mhchem is best thought of as an add-on to MathJax, it provides you with some extra functionality that is not originally present (or technically, that would be significantly harder to implement from scratch). So I agree with andselisk's comment very much, in that I suggest you read about MathJax (or LaTeX, which MathJax is very similar to) first.

The very basic overview that we host is here: How can I format math/chemistry expressions here? and I suggest reading this before anything else.

However, that is probably nowhere near enough for what you described. I'll provide some brief thoughts on your three use cases (I'm afraid I cannot give a full tutorial - that would take way too long and there are probably more helpful resources on the Internet anyway).

reaction mechanisms

If these are solely meant to be text- and arrow-based, then mhchem offers enough functionality for that. The GitHub documentation should have plenty of examples of things like adding text above arrows.

However, if you want to draw chemical structures, there is no realistic way that you can currently do that here (LaTeX has the chemfig package, but that is not available with our MathJax here). So you will have to use an external editor to draw that, save it as an image file, then upload it to your post.

BCE tables

I am not sure what BCE means, but tables in general can be done with the array environment. See below for a minimum example (anything after a % is a comment):

\begin{array}{c|cc}  % c for a centre-aligned column, | for line between columns
1 & 2 & 3 \\         % use & to separate cell contents, \\ to go to next line
4 & 5 & 6 \\
\hline               % \hline gives you a horizontal line
7 & 8 & 9

\begin{array}{c|cc} % c for a centre-aligned column, | for line between columns 1 & 2 & 3 \\ % use & to separate cell contents, \\ to go to next line 4 & 5 & 6 \\ \hline % \hline gives you a horizontal line 7 & 8 & 9 \end{array}

Hess law equations

This is more of a MathJax thing rather than mhchem. You can get Greek letters by prefacing them with a backslash: $\Delta$ gives $\Delta$, $X_Y$ gives subscripts $X_Y$, and so on. So you can write:

$$\Delta H_r = 2\Delta_f(H_2O) - 2\Delta_f(H_2) - \Delta_f(O_2)$$

$$\Delta H_r = 2\Delta_f(H_2O) - 2\Delta_f(H_2) - \Delta_f(O_2)$$

Note that the $r$, the $f$, as well as the chemical formulae should be in roman text (not italicised), so a more proper way to typeset the equation above is:

$$\Delta H_\mathrm{r} = 2\Delta_\mathrm{f}(\ce{H2O}) - 2\Delta_\mathrm{f}(\ce{H2}) - \Delta_\mathrm{f}(\ce{O2})$$

where we have used \mathrm{...} to set f and r in roman type, and \ce{...} (from mhchem) to typeset chemicals correctly, giving an equation that would not look out of place in a good textbook(!):

$$\Delta H_\mathrm{r} = 2\Delta_\mathrm{f}(\ce{H2O}) - 2\Delta_\mathrm{f}(\ce{H2}) - \Delta_\mathrm{f}(\ce{O2})$$


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .