Latex Eqnarray

Latex Eqnarray




👉🏻👉🏻👉🏻 ALL INFORMATION CLICK HERE 👈🏻👈🏻👈🏻




















































Frequently Asked Question List for TeX
The environment eqnarray is attractive for the occasional user of mathematics in LaTeX documents: it seems to allow aligned systems of equations. Indeed it does supply such things, but it makes a serious mess of spacing. In the system:
\begin{eqnarray}
a & = & b + c \\
x & = & y - z
\end{eqnarray}

the spacing around the “=” signs is not that defined in the metrics for the font from which the glyph comes — it’s \arraycolsep, which may be set to some very odd value for reasons associated with real arrays elsewhere in the document.
The user is far better served by the amsmath package, which provides an align environment, which is designed with the needs of mathematicians in mind (as opposed to the convenience of LaTeX programmers). For this simple case (align and other amsmath alignment environments are capable of far greater things), code as:
\begin{align}
a & = b + c \\
x & = y - z
\end{align}

The matter is discussed in more detail in a PracTeX journal paper by Lars Madsen; Stefan Kottwitz offers a TeX blog entry which includes screen shots of the output, convincingly demonstrating the problem.

There’s a lot of freely available documentation for LaTeX, but there’s a pitfall: some documents that are still online are outdated and therefore contain obsolete information. Documents like “Obsolete packages and commands” (“l2tabu”) address the need of up-to-date information.
For instance the obsolete eqnarray environment frequently appears in questions of new LaTeX users and many people including me usually answer: don’t use eqnarray and give advice how to use the align environment of amsmath instead.
Here’s a summary of the problems with eqnarray:
Here is one small example document just to illustrate the space inconsistany problem:
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{minipage}{0.5\textwidth}
equation:
\begin{equation*}
z_0 = d = 0
\end{equation*}
\begin{equation*}
z_{n+1} = z_n^2+c
\end{equation*}
align:
\begin{align*}
z_0 &= d = 0 \\
z_{n+1} &= z_n^2+c
\end{align*}
eqnarray:
\begin{eqnarray*}
z_0 &=& d = 0 \\
z_{n+1} &=& z_n^2+c
\end{eqnarray*}
\end{minipage}
\end{document}
Compile for yourself and examine it, if you want. For a quick look here’s a screenshot of the output:
Notice the difference of the spacing around the equal sign in the eqnarray environment compared to equation and even compared to the other equal sign inside the first eqnarray line.
If you try to repair the spacing by adjusting \arraycolsep you will notice that all other arrays including matrices will be affected too. So the best solution is to use amsmath, this package provides even more environments useful for multiline formulas and a lot more enhancement for mathematical typesetting.
For further information regarding this topic you may have a look at the article “Avoid eqnarray!” by Lars Madsen published in the PracTeX Journal 4 2006.
This topic was discussed on MatheBoard.
12. April 2008 by stefan
Categories: Mathematics | 92 comments
Very useful! I have been wondering what the difference is. Thanks!
Where is the documentation and specifications for the align environment ? For example, how do you control if it aligns a certain column left or right ?
the align environment has an implicit {rlrl…} alignment of its columns. The environment is documented in the amsmath user’s guide, further information can be found in the general Mathmode document.
One problem with the align environment is it appears that the pause command in Beamer does not work in align as it does in eqnarray. This may seem minor, but it’s important in my lectures to be able to step through multiline equations. Align does seem to be much nicer otherwise, so I would appreciate if anyone has advice on the pauses. Thanks!
Beamer’s pause doesn’t actually work inside any amsmath environment, “since these do really wicked things” according to the Beamer manual (v.3.06, page 63). You can find some workarounds through Google, though just using eqnarray in this case is the simplest.
You could step through align environments using the uncover macro. It works for unnumbered (starred) and numbered align environments, in the last case an empty untagged last line is necessary, see the beamer user guide 23.4 Uncovering Tagged Formulas Piecewise.
Thanks for the responses. The uncover solution works well. I wish I would have checked back here sooner. I’ll be using that a lot from now on. Thanks.
Hi, i’ve got a Problem with align.
According to your article I started to change the eqnarray s in my documents into align s. But in a certain case, don’t know why, I get a strange space, here is an example:

documentclass{scrreprt}
begin{eqnarray}
a & = & b\
b & = & c
end{eqnarray}
begin{align}
a & = & b\
b & = & c
end{align}
end{document}

I’d be happy if you could explain to me, where these huge space in the align between = and b comes from and how I can avoid it. Thanks.
In align environments the & symbol doesn’t separate columns, it marks the relation symbol. The correct way would be:
\begin{align}
a & = & b \\
b & = & c
\end{align}
The second & would cause an additional align-column, that’s why there’s that space. To see it try:
\begin{align}
a &= b & b &= a \\
b &= c & c &= b
\end{align}
I’ve got a different problem with align. I would like to label an equation with tag{H_T}, but the subscript gets it really confused and unhappy. tag{{H_T}} doesn’t fix it. Any ideas?
use math mode in the argument of tag, tag{(H_T)} or tag{$H_T$}.
Thanks for your answer, now I understand how align works, think I’m gonna use it every time now.
I have a couple more questions on align:
Is it possible to adjust the multi-column behavior in align? I’m looking for something like array, but that could display math in equation-style (big vees etc.)
Also, can I add/eat the space between the lines? I want to have dots leading to the last equation, but the line containing vdots is unevenly spaced with the ones around it:
begin{align*}
A_1 &= B_1\
& vdots\
A_n &= B_n
end{align*}
concerning multiple columns, amsmath provides several align-like environments, have a look at amsldoc.pdf. I’m often using the alignat environment when several columns are needed.
Line specific spacing is possible, just state the space in square brackets after the linebreak, for instance:
\begin{align*}
A_1 &= B_1\\
&\ \ \vdots\\[5pt]
A_n &= B_n
\end{align*}
Negative space is possible as well:
I have a problem with align. I’d like to label each row with label{} so that I can refer to the equations individually. I get an error message that multiple labels are not possible.
begin{align}
a &=blabel{eq1}\
c &=dlabel{eq2}
end{align}
there’s no problem in this code. This complete example is compilable without error and refers to both equations:
\documentclass[a4paper,10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
a &=b\label{eq1}\\
c &=d\label{eq2}
\end{align}
See \eqref{eq1} and \eqref{eq2}.
\end{document}
Try this one. Perhaps post a complete example here, like I did, that shows the error. Something else causes this problem, not visible in the piece of code here.
Hi all,
I just have few questions on fancy headings should some one extends a helping hand. I am writing a thesis and want to use this fancy thing. Here is what i have so far:

documentclass[reqno,12pt, twoside ]{article}
usepackage{fancyheadings}
renewcommand{sectionmark}[1]{markright{thesection #1}{}}
renewcommand{subsectionmark}[1]{markright{thesubsection #1}{}}
rhead{leftmark\rightmark}
fancyhead[LE,RO]{slshape rightmark}
fancyhead[LO,RE]{slshape leftmark}
fancyfoot[LE,RO]{thepage}

My questions:1. I want to remove the heading for the main titles(sections) while keeping the page number as it used to be(left or right depending on…)
2. I want to have the section title on the left hand side of the (even numbered pages) and the subsection title on the right hand side of (odd pages).
Any help would be appreciated.
I recommend to use fancyhdr instead of fancyheadings, this is an early version. Since you are writing a thesis consider to use another class than article. The article class is appropriate for smaller documents. You could use report or book instead, there are even some dedicated thesis classes.
book and report provide chapters. chapter starting pages would have another style, numbered but without heading. That may be what you would like to achieve.
Have a look at the fancyhdr documentation for explanation and examples. If you still have questions just write them here.
Thank you Stefan. I have been advised not use this chapter thing. If i do, i have to make sure that the word chapter should not appear where the chapter is supposed to begin. I can suppress it using chapter*{title}. The problem is then i need to have the chapter number before the title.
Yes you right, with this book or report document classes, the header from the chapter or mains section will disappear which is what i want. The problem with this is again, it puts the page number for that page at the center. I want the page number to be on the right.
using a KOMA-Script class could help. They are much more customizable. Further they don’t write out “Chapter” and they provide a very good package for headings and footers. The position of the page number looks also like you wished.
Test this small example:
\documentclass[a4paper,10pt]{scrbook}
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
The documentation will explain more, there’s a whole chapter dedicated to headings.
Thanks Stefan. This was what i had been looking for.It solved my problem!!!
I’ve been using align for years, however, the environment doesn’t seem to be a part of {iopart, iopams} (for publication in AMS journals), while eqnarray works – so there actually are situations where you can’t avoid using it. …and yes, the spacing is ugly!
how to move the equation to left-hand side or right-hand side?
To place the equations on the left side for the whole document, use the option fleqn for the document class or for the amsmath package.
Alternatively, to align equation arrays to the left or to the right side, you could use the flalign environment. Just use an additional column separator & on the right respectively the left side.
I would like to thank for the excelent post! I was using eqnarray a lot… However, it seems that there is a comment with a problem wich i have for my own, and is not answered… It seems that the problem is with the package “ntheorem”
The problem is with align’s labels.
I would like to thank for the excelent post! I was using eqnarray a lot… However, it seems that there is a comment with a problem wich i have for my own, and is not answered… It seems that the problem is with the package “ntheorem”
The problem is with align’s labels.
documentclass[a4paper,11pt,twoside]{article}
usepackage[utf8]{inputenc}
usepackage[portuguese]{babel}
usepackage[pdftex]{graphicx}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{amsmath}
usepackage[thmmarks]{ntheorem}
begin{document}
begin{equation}label{e1}
equation1
end{equation}
begin{align}
equation2 label{e2}\
equation3 label{e3}
end{align}
begin{align}
equation4 label{e4}\
equation5 label{e5}
end{align}
begin{equation}label{e6}
equation6
end{equation}
Equations ref{e1}, ref{e2}, ref{e3}, ref{e4}, ref{e5}, ref{e6}
Equations eqref{e1}, eqref{e2}, eqref{e3}, eqref{e4}, eqref{e5}, eqref{e6}.
Then there are errors with labels
! Package amsmath Error: Multiple label’s: label ‘e1′ will be lost.
begin{equation}label{e1}
equation1
end{equation}
begin{align}
equation2 \
equation3
end{align}
Then ref{e1} gets reference to equation 2!
It seems that if I remove ntheorem from the file, it compiles ok. Does anyone have the same problems? Is there a way to solve it? any link to proper documentation would help!
the problem is indeed caused by ntheorem. But that package provides an option that takes care of it, just add amsmath as option:
\usepackage[amsmath,thmmarks]{ntheorem}
Hi all,
I want latex to generate footnote consecutive numbers automatically through out my document. I tried to use this command footenote{text}.But it only generate consecutive numbers only with in a page. In a new page it always begins with 1 every time. I want all the footnotes through out the document to have different numbering say 1, 2…. I can do that manually using footenote[#]{text}. But it seems cumbersome. Can any one help me how to do it?
which document class do you use? Do you load the footmisc package or any other footnotes-related package?
Hi Stefan,
I use the document class scrbook. I loaded the footmisc package. But, it has not helped me.
that’s not the default behavior of scrbook and footmisc. In this example the second footnote will fall onto the second page and will get number 2:
\documentclass{scrbook}
\usepackage{footmisc}
\begin{document}
text\footnote{Test1}
\newpage
text\footnote{Test1}
\end{document}
So, there’s information missing. Perhaps post your preamble, I guess it’s caused by an option or package you didn’t mention. For instance, footmisc provides the option perpage, this causes such numbering per page. Or send me the preamble or a document by email to check.
Hi Stefan,
Here is my preamble
documentclass[12pt,a4paper,twoside,openright,BCOR=1cm]{scrbook}
usepackage{footmisc}
usepackage[english]{babel}
usepackage{blindtext}
usepackage{lmodern}
usepackage{fixltx2e}
usepackage{titlesec}
usepackage{amscd}
usepackage{amssymb}
%usepackage[margin=4cm]{geometry}
%usepackage[a4paper]{geometry}
usepackage{amstext}
usepackage{mathrsfs}
usepackage{relsize}
usepackage{mathptmx}
usepackage{makeidx}
usepackage{fancyhdr}
usepackage{textcomp}
usepackage[T1]{fontenc}
usepackage{verbatim, amsmath, amsfonts, amssymb, amsthm}
usepackage{microtype}
usepackage{setspace}
usepackage{pfnote}
usepackage{fnpos}
usepackage[final]{hyperref}
hypersetup{colorlinks=true, linkcolor=blue, anchorcolor=blue,
citecolor=red, filecolor=blue, menucolor=blue, pagecolor=blue,
urlcolor=blue}
Alem
The package pfnote resets the footnote counter for each page. As I believe that this is its only purpose, you would not need it.
Thank you very much Stefan. I removed that, and got what i exactly want. you have been really of a great help!
Alem
Hi all
I just want to generate Nomeclature to my documents.I put the following and it perfectly runs. But it could not generate the nomenclatures. Any help please
documentclass{article}
usepackage{nomencl}
%usepackage{makeidx}
makenomenclature
begin{document}
section*{Nomenlature}
nomenclature[ac]{$a$}{The number of angels per unit area}
nomenclature {$N$}{The number of angels per needle point}%
nomenclature {$A$}{The area of the needle point}%
printnomenclature
you have to run the program makeindex at the command prompt:

makeindex filename.nlo -s nomencl.ist -o filename.nls

Hi Stefan
I am kind of new for latex. I read the manual and found also that i have to run the makeindex file as you said it. How do i run that? i could not find the file with that extension either.
Abebek
Run it at the command prompt. On Windows, that means: click Start, Programs, Accessories, Command Prompt or press the keys STRG and R together (Start, Run) and type cmd in that Start/Run dialog.
A command prompt window opens, which is usually black and contains only text. Change to your docment directory using the cd command, then type this makeindex command above.
This is not LaTeX, it requires some Windows/DOS knowhow. Some LaTeX editors such as TeXnicCenter can run makeindex automatically. Try the command prompt, otherwise I recommend to use TexnicCenter: http://www.texniccenter.org/
I am writing a paper using “align” commands. In the beginning everything was OK, but later I got some strange vertical large spacing before a block of equations and after, when I used “align”, and this happening with only the blocks of equations WITHIN THE SAME PAGE. This problem occur for some “align” commands NOT all of them.
Any idea what the source of this problem is ?
Thanks in advance.
perhaps it’s just because LaTeX tries to fill up the page. You could try raggedbottom in your preamble. Otherwise you could send me a code example showing the problem by email.
It Works ! raggedbottom solve the problem. Thanks a lot for the help !! Have a nice weekend.
Hi all,
I want to include a pdf picture in my latex document. I use document class scrbook and winedit editor and run it with pdflatex. I have inserted the graphic package where it should be and the following is what i tried
begin{figure}[htb]
begin{center}
includegraphics[height=1in,width=1in]{myfig.pdf}
caption{This is a figure.}
end{center}
end{figure}
With this, it could not run let alone producing the pic. Any help please?
to add few points:
I also use pdflatex compiler. I put includegraphics[height=1in,width=1in]{myfig}
without any extension as my figs are all in pdf and png formats.
I am facing a problem with the align command.
I need to include a running text in the first line followed by an equation in the second line. My latex code is as below:
begin{align}label{mylabel}
text{running text}nonumber\
dot{vx} & = & (A_{i}+Delta A_{i})vx+(B_{i}+Delta B_{i})boldsymbol{u}
end{align}
On compilation of the above code, the equation gets aligned to the right and the text gets left aligned. However, I need the equation to be center aligned and the text left aligned.
in this case don’t use align. Write your text left aligned as usual and use an equation environment afterwards. Since the text is not a formula, writing it into a formula line (and repairing the alignment concequences afterwards) is not meaningful.
Though it could be fixed by rlap, makebox, mathrlap and the like, but that would not be logical.
if you don’t tell the error message I cannot help. Perhaps the problem has been solved. Otherwise please provide some more information.
I have a problem with alignment of equations, maybe you have an idea for me?
My problem is this: in the first line, i have a few characters, that are supposed to be followed by a certain amount of space and then a long mathematical formula, that should spread over the full line (no further columns). In the second line, there are also a few characters first, which I want aligned on the right with the ones in the first line. Then there is an equation and some conditions for the equation, i.e. two “columns”, one with the equation, one with the annotations. The next lines contain only the equations and annotations, I would like them aligned with the equation and annotation of the second line.
Schematically, this is what its supposed to look like:
xxxx xxxxxxxxxxxxxxxxx (1)
xxx xxxx=xxxx xxxxx (2)
xxxxx=xx xxx (3)
xxx=xxx xxxx (4)
I tried with align and then an aligned-environment ins
Klio Base Latex
Hp Latex 26500
Latex Vk Com
Clear Latex
Latex Test
eqnarray (LaTeX2e unofficial reference manual (December 2…
Why not use eqnarray? | The TeX FAQ
eqnarray vs. align | TeXblog
Using the eqnarray package - Andrew Roberts
Latex Eqnarray


Report Page