# Errors thrown when using (custom) thermodynamic states in chemmacros's reactions environment

An argument error is thrown when I attempt to use thermodynamic states (as well as custom state variables via \DeclareChemState) in chemmacros's reactions environment.

The MWE provided at the end of the question will reproduce the following error upon (at the time of this question) typesetting with the most updated version of TeX Live 2012.

The error:

[...] Argument of \chemformula_superscript:n has an extra }.
<inserted text>
\par
l.8 \end{reactions}


The MWE:

\documentclass[12pt]{article}
\usepackage{chemmacros}
\DeclareChemState[delta=false]{StdElPot}{E}{\volt}
\begin{document}
\begin{reactions}
Pd\pch[2]\aq{} + 2 \el{} &<=> Pd\sld{} &&\StdElPot{0.83} \\
PdCl4\mch[2]\aq{} + 2 \el{} &<=> Pd\sld{} + 4 Cl\mch\aq{} &&\StdElPot{0.64}
\end{reactions}
\end{document}

-

I seem to have missed this one...

You haven't escaped \StdElPot and so chemmacros assumes the numbers in its argument are subscripts to atoms. Escaping is easy: put the part that has to be escaped between "", see section 25.3. Commands and section 27. Escaped Input of the manual for details.

BTW: the usage of \pch and \mch is not recommended in the reaction and reactions environments nor in \ch. The manual clearly states this:

The preferred syntax thus would look as follows:

\documentclass[12pt]{article}
\usepackage{chemmacros}
\DeclareChemState[delta=false]{StdElPot}{E}{\volt}
\begin{document}
\begin{reactions}
Pd^2+ \aq{}    + 2 e- &<=> Pd\sld{}               && "\StdElPot{0.83}" \\
PdCl4^2- \aq{} + 2 e- &<=> Pd\sld{} + 4 Cl- \aq{} && "\StdElPot{0.64}"
\end{reactions}
\end{document}


-