eqnarray with subnumber
Avoid eqnarray
! Use the align
environment inside the subequations
environment from the amsmath package.
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools} % loads »amsmath«
\begin{document}
\begin{subequations}
\begin{align}
(a+b)^2 &= a^2+2ab+b^2 \\
(a-b)^2 &= a^2-2ab+b^2 \\
(a+b)(a-b) &= a^2-b^2
\end{align}
\end{subequations}
\end{document}
amsmath
has an environment subequations
that will do what you want:
\begin{subequations}
\begin{eqnarray}
eq \\
eq \\
eq
\end{eqnarray}
\end{subequations}
some observations:
- you don't want blank lines withn the scope of display math; they will result in error messages.
- you don't want
\\
at the end of the last line, or you'll end up with too much space below the display. - it would really be better to use one of the multi-line display structures provided by
amsmath
rather thaneqnarray
(see this article for the reasons why).
to find out what structures are provided by amsmath
, if you have a tex live installation, type texdoc amsmath
at a command line prompt.
The second look (with a, b, c ... appended to the "main" equation number) can be achieved with the subequations
environment of the amsmath
package. The following MWE (minimum working example) demonstrates the basic usage of this package:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\begin{align}
a &= b\\
c &= d\\
e &= f
\end{align}
\end{subequations}
\end{document}
Finally: Don't use the eqnarray
environment -- use the align
environment instead.
The eqnarray
environment has several severe shortcomings; for a justification of this assertion see, for instance, "\eqnarray vs \align".