3

The following short sample generates a list of numbered chemical reactions. I would like to change the numbering from the default (1) and (2) to (R1) and (R2).

\documentclass[]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{empheq}
\begin{document}
\begin{empheq}[right=\quad\empheqrbrace \text{\ce{C-H} fission}]{align}
\ce{CH3CHO &-> CH3CO + H} \\
\ce{CH3CHO &-> CH2CHO + H}
\end{empheq}
\end{document}

I tried using the technique given here, shown below, changing what's given in the link to align, but it errors out reporting Package keyval Error: reaction undefined.

\documentclass[]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{empheq}
\newcounter{defcounter}
\setcounter{defcounter}{0}
\newenvironment{reaction}{%
\addtocounter{align}{-1}
\refstepcounter{defcounter}
\renewcommand\theequation{R\thedefcounter}
\begin{align}}
{\end{align}}

\begin{document}
\begin{empheq}[right=\quad\empheqrbrace \text{\ce{C-H} fission}]{reaction}
\ce{CH3CHO &-> CH3CO + H} \\
\ce{CH3CHO &-> CH2CHO + H}
\end{empheq}

\end{document}
Justin
  • 33
  • 1
    Welcome to TeX.SX! Can you please clarify what you are trying to do. Specifically, do you want ALL equations numbered as (R1), (R2), ... or just some of them? If the latter, please say whether you want the numbering to look like (1), (2), (R3), (R4), (5), ..., or for the R-numbers to be independent of the other equation numbers. –  Jul 01 '15 at 22:52

1 Answers1

2

The empheq package provides clever means to create nice equations. Using wrappers for some other setup requires some work to do (see section 6 Creating something new for examples and descriptions)

I've decided to use a special reactempheq environment which uses the common equation counter but applies the (R1) format. The usual empheq environment is not changed by this.

\documentclass[]{article}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}
\usepackage{empheq}
\begin{document}

\newenvironment{reactempheq}[2][]{%
  \renewcommand{\theequation}{R\arabic{equation}}
  \setkeys{EmphEqEnv}{#2}%
  \setkeys{EmphEqOpt}{#1}%
  \EmphEqMainEnv%
}{%
  \endEmphEqMainEnv%
}


\begin{reactempheq}[right=\quad\empheqrbrace \text{\ce{C-H} fission}]{align}
\ce{CH3CHO &-> CH3CO + H} \\
\ce{CH3CHO &-> CH2CHO + H}
\end{reactempheq}

\begin{empheq}[right=\quad\empheqrbrace \text{\ce{C-H} fission}]{align}
\ce{CH3CHO &-> CH3CO + H} \\
\ce{CH3CHO &-> CH2CHO + H}
\end{empheq}

\end{document}

enter image description here