Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to introduce a set of chemical reactions (see code below) within a text containing some standard equations. Standard equations should be numbered continuously, but the chemical reactions should be numbered R1-Rn. How can i do that ?

\begin{align}
  \ce{CH4} &+ \frac{3}{2}\ce{O2} \rightarrow \ce{CO} + 2\ce{H2O} \label{eqn:hom2}\\
  \ce{CO}  &+ \frac{1}{2}\ce{O2} \rightarrow \ce{CO2} \label{eqn:hom3} 
\end{align}
share|improve this question
2  
Welcome to TeX.SX! Are you using any chemistry package? Could you provide an example of the equations and how you typeset them in your document? –  Ludovic C. Dec 1 '13 at 12:18

1 Answer 1

up vote 5 down vote accepted

Here is a solution:

\documentclass{article}

\newcounter{chem}
\newcounter{temp}

\usepackage{amsmath}
\usepackage{mhchem}

\newenvironment{chequation}{%
  \setcounter{temp}{\value{equation}}%
  \setcounter{equation}{\value{chem}}%
  \renewcommand{\theequation}{R\arabic{equation}}%
}{%
  \setcounter{chem}{\value{equation}}%
  \setcounter{equation}{\value{temp}}%
}


\begin{document}

\noindent
A \hfill Z
\begin{equation}
\label{eq1}
x+y=z
\end{equation}

\begin{chequation}
\begin{align}
  \ce{CH4} &+ \frac{3}{2}\ce{O2} \rightarrow \ce{CO} + 2\ce{H2O} \label{eqn:hom2}\\
  \ce{CO}  &+ \frac{1}{2}\ce{O2} \rightarrow \ce{CO2} \label{eqn:hom3} 
\end{align}
\end{chequation}

\begin{equation}
\label{eq2}
x^2+y^2=1
\end{equation}

\begin{equation}
\label{eq3}
x^2-y^2=1
\end{equation}

\begin{chequation}
\begin{align}
  \ce{CH4} &+ \frac{3}{2}\ce{O2} \rightarrow \ce{CO} + 2\ce{H2O} \label{eqn:foo}\\
  \ce{CO}  &+ \frac{1}{2}\ce{O2} \rightarrow \ce{CO2} \label{eqn:bar} 
\end{align}
\end{chequation}

In this example I have Reactions~\ref{eqn:hom2},~\ref{eqn:hom3},~\ref{eqn:foo} and~\ref{eqn:bar}, as well as Equations~\ref{eq1},~\ref{eq2} and~\ref{eq3}.

\noindent A \hfill Z

\end{document}

and its output:

Output

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.