Since can't set a label to a chemical reaction with chemfig
package, the only solution is put the scheme between \begin{equation}
and \end{equation}
\begin{equation}
\schemestart
2 \ce{H_{2}O} \arrow{<=>} \ce{H_{3}O^{+}} \+ \ce{OH^{-}}
\schemestop
\end{equation}
And this, works fine. So, I think to create a new newenvironment called "reaction": this is my attempt
\documentclass[12pt]{article}
\usepackage{chemfig}
\usepackage[version=3]{mhchem}
\newenvironment{reaction}
{
\centering
\begin{equation}
\schemestart
\schemestop
\end{equation}
}
\begin{document}
\begin{reaction}
2 \ce{H_{2}O} \arrow{<=>} \ce{H_{3}O^{+}} \+ \ce{OH^{-}}
\end{reaction}
\end{document}
This is the error message:
! Undefined control sequence. 2 \ce{H_{2}O} \arrow
Seems like \arrow
sequence not works on reaction environment
How can I improve the new environment?
\centering
has no effect on equations. Your\newenvironemnt
is missing the third argument with the end code, I assume you intended}
after\schemestart
and{
before\schemestop
so the environment body goes between those?\newenvironemnt
content between\schemestart
and\schemestop