I heard that it is recommended to use align or array. But how should I do so to replace the use of eqnarray? Thank you very much.
Asked
Active
Viewed 1.4k times
4
2 Answers
3
With an eqnarray environment, you might write:
\begin{eqnarray}
a &=& b\\
c &=& d
\end{eqnarray}
With an align environment (be sure to load the amsmath package), you'd write
\begin{align}
a &= b\\
c &= d
\end{align}
The only significant change -- other than the change in the name of the environment, of course -- is that one writes &= (not =&!) when using an align environment in order to bring about alignment on the = symbol.
Mico
- 506,678
-
1@kwyip - I wouldn't use an
array, for 3 reasons. First, the cells in anarrayare typeset in "text-style math" mode by default, whereas the material in analignenvironment is set in "display-style math" mode. Second, the spacing between rows is much tighter (too tight, in many cases) in anarray. Third, witharrayyou don't get the easy ability to number individual lines of a multi-line equation. You may also want to look into theIEEEeqnarrayenvironment that's provided by the IEEEtrantools package. – Mico May 13 '15 at 23:20 -
I want to produce big parathesis like this http://tex.stackexchange.com/questions/122778/left-brace-including-several-lines-in-eqnarray How do I do this with "align" instead of "array"? Thanks. – Ka Wa Yip May 14 '15 at 00:58
-
@kwyip - That's a new question. Please post it as a new question, to give it a chance to be seen by more people. Thanks. – Mico May 14 '15 at 01:22
-
-
@kwyip - I honestly don't know how to generate the construct mentioned in the newer posting using an
alignenvironment;alignseems utterly unsuitable to the task. Why don't you want to use acasesenvironment for that construct? – Mico May 16 '15 at 08:35
0
You can use the equationarray environment which is loaded with the eqnarray package. It is a math environment that mimics the behavior of the array environment which is more suited for text. It also adds a different number to each equation. Unlike the eqnarray environment, you can align more than 3 columns of information.
Simply add
\usepackage{eqnarray}
to the preamble. Then you can use equationarray exactly as you would use an array:
\begin{equationarray}{rclrcl}
a &=& b & c &=& d\\
c &=& d & a &=& b
\end{equationarray}
Meclassic
- 1,795
- 2
- 18
- 27
alignis a more or less exact replacement, just take care to use&=rather than&=&when switching fromeqnarraytoalign– David Carlisle May 13 '15 at 20:20arrayis not the same kind of environment at all: it is not for setting display equations it is for settings arrays/matrices within a math environment such asalignorequalign– David Carlisle May 13 '15 at 22:54