chemistrykatex

Create chemical equilibrium symbol in Katex


I'm trying to create this symbol in KaTex:

enter image description here

(I know there are the KaTex commands \xrightleftharpoons{} and \rightleftharpoons, but they make both arrows the same length.)

It's for an explanation of chemical equilibrium.

best I managed is putting an arrow over an arrow:

\begin{array}{c}
   \scriptstyle exotherm\thinspace \thinspace \thinspace \thinspace\\
   H_2O + H_2O \thinspace \overleftharpoon{\thinspace\thinspace{\scriptscriptstyle\rightharpoondown} \thinspace\thinspace} \thinspace H_3O^+ + OH^-\\s
   \scriptstyle endotherm\thinspace \thinspace \thinspace \thinspace 
\end{array}

renders as (on https://katex.org/):

enter image description here

The problem is, I have no idea how to make the long arrow be on the bottom. Is there a way to do this? The function \underleftharpoon{} does not exist in KaTex.

(I want to do this in KaTex, not MathJax)


Solution

  • Katex provides the mhchem extension to write chemical equations.
    According to their documentation for reaction arrows mhchem provides a stretched arrow functionality.

    $\ce{H2O + H2O <<=>[exotherm][sendotherm]H3O+ + OH-}$

    results in the following output:
    enter image description here

    Hope this helps. Otherwise the solution in your comment seems promising.