7

When I use eqnarray

\begin{eqnarray}

eq\\
eq\\
eq\\

\end{eqnarray}

this show me

eq (1)
eq (2)
eq (3)

In some papers I see this output

eq (1a)
eq (1b) 
eq (1c) 

how I can make this way ?

8

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 than eqnarray (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.

|improve this answer|||||
13

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}
|improve this answer|||||
8

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}

enter image description here

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

|improve this answer|||||
  • shouldn't a backslash be appended to 'a &= b\', so that 'a &= b\\'? – Herpes Free Engineer Apr 21 '17 at 17:21
  • 3
    @Kuti - Thanks. Some months ago, a site-wide bug swept thru lots and lots of postings and "converted" instances of double-backslash to single-backslash. The only apparent recovery from this bug is to hand-edit the postings to restore the instances of double-backslash. A nightmare job, honestly. (I just "fixed" this posting, BTW.) – Mico May 28 '17 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.