# How to create new environment based on subequations

I've created new environment based on equation for chemical reactions that use roman numbers. I would like to create another environment based on subequations that use this numbering format. Below you can find the MWE.

\documentclass[a4paper,twoside,openright,12pt]{memoir}

\usepackage{amsmath}

\newcounter{chemEquationCounter}[chapter]
\renewcommand*\thechemEquationCounter{\thechapter. \Roman{chemEquationCounter}}
\newenvironment{chemEquation}{%
\stepcounter{chemEquationCounter}%
$$% }% {\tag{\thechemEquationCounter}%$$%
}

\newenvironment{mathSubEquations}%
{%
\begin{subequations}%
\renewcommand{\theequation}{\theparentequation-\alph{equation}%
}
}%
{%
\end{subequations}%
}%

\newenvironment{chemSubEquations}%
{%
\begin{subequations}%
\renewcommand{\theequation}{\theparentequation-\alph{equation}%
}
}%
{%
\end{subequations}%
}%

\newenvironment{eqs}
{\subequations\align}
{\endalign\endsubequations}

\begin{document}
\chapter{Chapter 1}

$$a=b.c$$

\begin{chemEquation}
2H_2 + O_2 \rightarrow 2H_2O
\end{chemEquation}

\begin{mathSubEquations}
$$a=b.c$$
$$d=e.f$$
\end{mathSubEquations}

\begin{chemSubEquations}
\begin{chemEquation}
CH_4 + O_2 \rightarrow CO_2 + 2H_2O
\end{chemEquation}
\begin{chemEquation}
NaOH + HCl \rightarrow NaCl + H_2O
\end{chemEquation}
\end{chemSubEquations}
\end{document}


that give's me: I want chemical reactions to appear like math equations. But as you could see chemical reactions below are formatted different. The numbering also is completely wrong. What I am missing?

• (1) the memoir tag is not relevant here, (2) might be an idea if you explained what you then actually wanted instead of just writing that it is not what you want. – daleif Sep 28 '16 at 11:27
• @daleif memoir tag removed. – alchemist_ bg Sep 28 '16 at 11:51
• (1) remember to use chchem to format the chemetry, (2) you are not using \theequation in your chemical equation, you are overwriting it using \tag – daleif Sep 28 '16 at 12:37
• Isn't it mhchem? Also, chemformula is another possibility. – Bernard Sep 28 '16 at 13:47