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.

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?

share|improve this question

1 Answer 1

up vote 17 down vote accepted

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).

share|improve this answer
5  
tex.ac.uk/tex-archive/info/math/voss/mathmode/Mathmode.pdf has some explanations at page 33. –  qbi Jul 28 '10 at 18:02
1  
You mean section 33, page 60. Very useful document there. Thanks. –  Willie Wong Jul 28 '10 at 18:31
1  
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

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.