# How to number a set of equations separately from another set?

How can I number a set of equations separately from another set?

For example, if we have a file with this contents:

\documentclass{report}

\usepackage{amsmath}

\begin{document}

$$\label{Equation:1} 0+0=0$$

$$\label{Result:1} 1*1=1$$

$$\label{Equation:2} 0+1=1$$

$$\label{Result:2} 1*2=2$$

Equation \ref{Equation:1} and Equation \ref{Equation:2}.
Result \ref{Result:1} and Result \ref{Result:2}.

\end{document}


How to number the Equations separately from the Results?

In this example the output is:

Equation 1 and Equation 3. Result 2 and Result 4.

but I would like:

Equation 1 and Equation 2. Result 1 and Result 2.

How can I do this?

What's the best way to do this?

-

## 2 Answers

You can define an environment where the equation counter is replaced by the result counter.

\documentclass{report}
\usepackage{amsmath}
\newcounter{result}
%\renewcommand{\theresult}{R-\arabic{result}}

\makeatletter
\newcommand{\changeequationintoresult}{%
\let\c@equation\c@result\let\theequation\theresult}
\makeatletter

\newenvironment{results}{\changeequationintoresult}{}

\begin{document}

$$\label{Equation:1} 0+0=0$$

\begin{results}
$$\label{Result:1} 1*1=1$$
\end{results}

$$\label{Equation:2} 0+1=1$$

\begin{results}
$$\label{Result:2} 1*2=2$$
\end{results}

Equation \ref{Equation:1} and Equation \ref{Equation:2}.
Result \ref{Result:1} and Result \ref{Result:2}.

\end{document}


If you need only the equation environment, you can define a new environment, say requation:

\newenvironment{requation}
{\changeequationintoresult\equation}
{\endequation}


and say

\begin{requation}
\label{Result:1}
1*1=1
\end{requation}


instead of the more complicated double environment. In a similar way also the other amsmath environment can be treated.

-
This works fine. Very interesting, thx. Can you point a link to learn more about this enviroments and new commands? – GarouDan Nov 25 '11 at 23:20

The best way is to use subequations from amsmath.

\documentclass{report}

\usepackage{amsmath}

\begin{document}

\begin{subequations}
$$\label{eq:foo} 0+0=0$$

$$\label{re:foo} 1*1=1$$
\end{subequations}

\begin{subequations}
$$\label{eq:bar} 0+1=1$$

$$\label{re:bar} 1*2=2$$
\end{subequations}

Equation \ref{eq:foo} and Equation \ref{eq:bar}.
Result \ref{re:foo} and Result \ref{re:bar}.

\end{document}


It is different with your code. But will be useful.

-
Can we use the first set of equations without a and the second without b? This is because the first is my equations, but in my document I need call several results obtained before, so I'd like enumerate them. If I enumerate the main equations using this a will be strange. I think if we can use this subequations, but no putting this a and b and still keeping the order of equations and results will work fine. – GarouDan Nov 25 '11 at 22:41
@GarouDan: Yes, we can. Just redefine the \theequation which is explained in amsldoc. Personally I don't like ambigous numbers, so I didn't provide what you require on purpose. – Leo Liu Nov 26 '11 at 7:00