2

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}%
\begin{equation}%
}%
{\tag{\thechemEquationCounter}%
\end{equation}%
}

\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}

\begin{equation}
    a=b.c
\end{equation}

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

\begin{mathSubEquations}
    \begin{equation}
        a=b.c
    \end{equation}
    \begin{equation}
        d=e.f
    \end{equation}
\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:enter image description here 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
    (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
  • 2
    (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
  • 1
    Isn't it mhchem? Also, chemformula is another possibility. – Bernard Sep 28 '16 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.