Math mode in chemformula

Inside a reactions environment, _ changes its meaning; you can use \sb in its place. For ^ there is \sp.

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{chemmacros}
\chemsetup{modules={reactions}}
\begin{document}
\begin{reactions}
X -> Y  &\hfill &   \text{because\ $E=m\sb{x}c^2$}
\end{reactions}
\begin{reactions}
A + B &->[$E\sb{a,1}$] AB \\
A + K + B &->[$E\sb{a,2}$] AK ->[$E\sb{a,3}$] AB + P
\end{reactions}
\end{document}

enter image description here


When using chemformula it is important to know that spaces separate different parts inside \ch{..} and – as a consequence – inside a reaction environment. This means ->[ $E_{a,1}$ ] will work. There is only one thing else to keep in mind: chemformula per default inserts some space before a math part. (I am not convinced any more this is the best default behaviour, but…)

BTW: it also doesn't make much sense (IMHO it's actually wrong) to write a text part within \ch{...} with \text. The recommended way in chemformula is escaping text with "...": "because\ $E=m_{x}c^2$".

\documentclass[12pt,a4paper]{scrartcl}
\usepackage{chemmacros}
\chemsetup{
  modules={reactions} ,
  formula = chemformula ,
  chemformula/math-space = 0pt
}
\begin{document}

\begin{reactions}
  X -> Y  & & "because\ $E=m_{x}c^2$"
\end{reactions}

\begin{reactions}
  A + B &->[ $E_{a,1}$ ] AB \\
  A + K + B &->[ $E_{a,2}$ ] AK ->[ $E_{a,3}$ ] AB + P
\end{reactions}

\end{document}

enter image description here