4

I'm trying to write up a paper and I'd like to have a different class of labels for identities vs equations. ie I want something like \label{eq:firsteq} and \label{id:firstid} such that the numbering system for my identities (\ref{id: whatever) is distinct from my numbering system for equations (\ref{eq: whatever}).

For example say I have

\begin{equation}\label{eq:firsteq} a = b \end{equation}

\begin{equation}\label{id:firstid} c = d \end{equation}

Then I want something so that when I call

\ref{eq:firsteq}

\ref{id:firstid}

I get 1 and 1, not 1 and 2. I've tried googling and found something for distinct enumeration of figures under the caption package, but I'm not doing it for figures. Thanks for your help!

2
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Commented Jan 5, 2015 at 17:21
  • The usual approach here would be to start with two different environment names as the label/ref system is set up such that the labels themselves don't have to have any particular structure. Is there some logical distinction between your two classes of equation?
    – Joseph Wright
    Commented Jan 6, 2015 at 7:24

1 Answer 1

1

What I did here was use \meaning to determine how the equation environment is defined. I then fashioned an identity environment on the same lines, using a different counter, and label format (brackets, not parens).

It becomes the user's responsibility to use the appropriate equation or identity environment.

\documentclass{article}
\usepackage[T1]{fontenc}
\newcounter{identity}
\makeatletter
\newenvironment{identity}
  {$$\refstepcounter{identity}}
  {\eqno\hbox{[\arabic{identity}]}$$\@ignoretrue}
\makeatother
\begin{document}
\meaning\equation

\meaning\endequation

\begin{equation}\label{eq:firsteq} a = b \end{equation}

\begin{identity}\label{id:firstid} c = d \end{identity}

Reference equation \ref{eq:firsteq}.

Reference identity \ref{id:firstid}.
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .