23

Sometimes it is convenient to refer to a group of equations by a letter and a number. For example:

2+1   (A1)
2+4   (A2)
x^4   (B3)
x^e   (B4)

Placing \tag{A\theequation}\label{eqn:thisone}\stepcounter{equation}} instead of just \label{eqn:thisone} works, but seems hacky (especially manually stepping the counter).

Is there a better way?

lockstep
  • 250,273
Niall Murphy
  • 1,451

1 Answers1

30

The subequations environment provided by the amsmath package trivially allows you to get equations grouped by number and differentiated by letter. For example,

\begin{subequations}
  \begin{align}
    2+1 & \\
    2+4 &
  \end{align}
\end{subequations}
\begin{subequations}
  \begin{align}
    x^4 & \\
    x^e &
  \end{align}
\end{subequations}

will give the output

2+1   (1a)
2+4   (1b) 

x^4   (2a)
x^e   (2b)

By redefining how the equation and subequation counters are displayed, you should also be able to switch the primary labeling to Alpha and the secondary to arabic if you specifically want (A1) and (A2) instead of (1a) and (1b).

David Carlisle
  • 757,742
Michael Underwood
  • 21,356
  • 13
  • 52
  • 41
  • 5
    http://www.tex.ac.uk/tex-archive/info/math/voss/mathmode/Mathmode.pdf has some explanations at page 33. – qbi Jul 28 '10 at 18:02
  • 2
    You mean section 33, page 60. Very useful document there. Thanks. – Willie Wong Jul 28 '10 at 18:31
  • 2
    Subequations are probably what most other people people will want. In my case I wanted to keep the same counter for all the equations. Your answer lead me to find the command \renewcommand{\theequation}{A\arabic{equation}} which does what I need. – Niall Murphy Jul 29 '10 at 19:22
  • 1
    @qbi Your link is in error now. Shouldn't it be ftp://ftp.dante.de/tex-archive/info/math/voss/mathmode/Mathmode.pdf ? – Clément Apr 27 '16 at 03:35
  • @Clément your linkis in error now! I don't know the document in question; any change of a new link? Thanks :) – Sam OT Jul 06 '18 at 11:23
  • 2
    @SamT Try http://tug.ctan.org/obsolete/info/math/voss/mathmode/Mathmode.pdf (archived at https://web.archive.org/web/20171013201217/http://tug.ctan.org/obsolete/info/math/voss/mathmode/Mathmode.pdf ) – Clément Jul 06 '18 at 15:12