Typography with TeX and LaTeX

## eqnarray vs. align

April 12th, 2008 by Stefan Kottwitz

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:

• the spacing around relation symbols are inconsistent,
• long equations might collide with the equation numbers,
• there could be problems with labels and references.

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.

See the amsmath user’s guide.

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.

This entry was posted on Samstag, April 12th, 2008 at 22:08 and is filed under Mathematics. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

### 86 responses about “eqnarray vs. align”

1. Catherine Davey said:

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 ?

3. Stefan Kottwitz said:

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.

Stefan

4. Bob said:

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!

5. David Schaich said:

Bob,

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.

6. Stefan Kottwitz said:

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.

7. Bob said:

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.

8. Christian said:

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}

\usepackage{amsmath}

\begin{document}

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

9. Stefan Kottwitz said:

Hi Christian!

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}

Stefan

10. Allen K. said:

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?

11. Stefan Kottwitz said:

Hi Allen,

use math mode in the argument of tag, \tag{$$H_T$$} or \tag{$H_T$}.

Stefan

12. Allen K. said:

Excellent, thank you!

13. Christian said:

Thanks for your answer, now I understand how align works, think I’m gonna use it every time now.

Christian

14. andrew said:

Hi all,

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*}

Thanks a lot,
Andrew

15. Stefan Kottwitz said:

Hi Andrew,

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:

A_1 &= B_1\\[-5pt]

Stefan

16. andrew said:

Thank you Stefan!

17. Anna said:

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 &=b\label{eq1}\\
c &=d\label{eq2}
\end{align}

18. Stefan Kottwitz said:

Hi Anna,

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.

Stefan

19. Alem said:

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

20. Stefan Kottwitz said:

Hi Alem,

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.

Stefan

21. Alem said:

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.

22. Stefan Kottwitz said:

Hi Alem,

using a KOMA 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.

Stefan

23. Alem said:

Thanks Stefan. This was what i had been looking for.It solved my problem!!!

24. Corinna said:

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!

25. athens said:

how to move the equation to left-hand side or right-hand side?

26. Stefan Kottwitz said:

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.

27. Jukka said:

Thanks, you saved my day

28. Yul said:

Hello Mr. Stefan!

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.

29. Yul said:

Hello Mr. Stefan!

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}

\label{e1}
equation1

\begin{align}
equation2 \label{e2}\\
equation3 \label{e3}
\end{align}

\begin{align}
equation4 \label{e4}\\
equation5 \label{e5}
\end{align}

\label{e6}
equation6

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.

However, if i put

\label{e1}
equation1

\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!

Thank you very much.

30. Stefan Kottwitz said:

Hi Yul,

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}
31. Alem said:

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?

32. Stefan Kottwitz said:

Hi Alem,

which document class do you use? Do you load the footmisc package or any other footnotes-related package?

33. Alem said:

Hi Stefan,
I use the document class scrbook. I loaded the footmisc package. But, it has not helped me.

34. Stefan Kottwitz said:

Hi Alem,

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.

Stefan

35. alem said:

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}
urlcolor=blue}
Alem

36. Stefan Kottwitz said:

Hi Alem,

just remove that line:

\usepackage{pfnote} 

The package pfnote resets the footnote counter for each page. As I believe that this is its only purpose, you would not need it.

Stefan

37. alem said:

Thank you very much Stefan. I removed that, and got what i exactly want. you have been really of a great help!
Alem

38. Abebek said:

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

\end{document}

39. Stefan Kottwitz said:

Hi Abebek,

you have to run the program makeindex at the command prompt:

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

40. Abebek said:

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

41. Stefan Kottwitz said:

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/

42. Ramirez said:

Hi Stefan,

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 ?

43. Stefan Kottwitz said:

Hi Ramirez,

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.

44. Ramirez said:

Hi Stefan,

It Works ! \raggedbottom solve the problem. Thanks a lot for the help !! Have a nice weekend.

45. akurye said:

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?

46. akurye said:

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.

47. Mukunda said:

Hello,

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.

Thanks,
Mukunda

48. Stefan Kottwitz said:

Hi Mukunda,

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.

Stefan

49. Stefan Kottwitz said:

Hi akurye,

if you don’t tell the error message I cannot help. Perhaps the problem has been solved. Otherwise please provide some more information.

Stefan

50. taura said:

Hi Stefan,

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 inside the align. This worked tolerably for the alignemant, but then i couldn’t number and reference the lines individually, which i need sadly…

Is there another environment, that can do what I need? Or do you have any ideas, how I might realize it with align? I’d be very thankful for any help!

taura

51. taura said:

Uhm, well, after sending, the schematic doesn’t look like what I meant anymore. I guess, multiple spaces are killed by this editor

I hope you can still get, what I mean by my despcription! (The = are supposed to be aligned, the xxxx in the first and xxx in the second line aligned right, and the xxxxx, xxx and xxxx in second, thrid and fourth line aligned left.)

52. Stefan Kottwitz said:

Hi Taura!

You could use the alignat environment, it’s for aligning at several places. It’s also explained in the amsmath user’s guide.

Stefan

53. taura said:

Thanks for the answer! I saw and tried alignat, but couldn’t find a way, to make it ignore some of the alignment for one line. That’s what I need though, because the first line is supposed to use the whole line after the first ‘&’ and ignore the alignment at the = and before the annotation, that happens in the next lines. Can alignat do that and I’m just not seeing it? Or is that in fact something, that can’t be implemented?

54. Stefan Kottwitz said:

Use \makebox, \rlap, \llap or similar.

For example:

 \usepackage{mathtools} ... \begin{alignat}{2} \mathrlap{long math formula} ... 

55. taura said:

Thanks a lot, you made my day!

56. Reece said:

Hi Stefan

Is there a way of using align over normal text?

I have 3 sections of equations with normal text in the middle, but align centres them all so the shorter ones don’t line up with the earlier ones.

i.e.

X = XXXXXXXXXXXXX
Y = YYYYYYYYYYYYY

X = XXXXX
Y = YYYYY

Ideally, i would like the second set to align with the first set.

Thanks

57. Stefan Kottwitz said:

Hi Reece,

just use one align environment and escape it by \intertext:

\begin{align} X &= XXXXXXXXXXXXX Y &= YYYYYYYYYYYYY \intertext{Adaptation of this gives:} X &= XXXXX Y &= YYYYY \end{align}
58. expert said:

Learning LaTeX is such a long journey …
Thanks for the tips.

59. Torok said:

Hello

I have a code:

\begin{align}
a &=b\label{eq1}\\
c &=d\label{eq2}
e &=f\label{eq3}
\end{align}
See \eqref{eq1} and \eqref{eq2}.

I would like to change it to system of equations with labels, for example (1a), (1b), (1c) - not (1),(2),(3). Set of equations means that it has to be started from one of { for all equations. How can we label only two selected equations (not three)?
I look for this solution a lot of time. I have no idea. It is possible to find solution??

60. Stefan Kottwitz said:

Hi Torok,

- you could use the subequations environment of amsmath for sub-numbering,

- use the \notag command to suppress an equation tag, just put it at the end of the line before the \\.

Stefan

61. Torok said:

Hi Stefan
Thank you for your help. I have tried with the subequations:

\begin{subequations}
\begin{empheq}[left=\empheqlbrace]{align}
a_1(x) &= b_1 \label{k}\\
a_2(x) &= b_2\\
a_3(x) &= b_3
\end{empheq}
\end{subequations}
See (\ref{k})

It is almost ideal solution. But I always have to add manual ( ) to ref.

Thank you!

62. Stefan Kottwitz said:

Hi Torok,

you could use \eqref instead of \ref. \eqref is provided by amsmath.

63. Cesar AGV said:

Hi Stefan,

I use align to a long sequence of steps and sometimes I want to write a description of what was done in each step, how could put that kind of text with the align environment? with an extra & and then \mbox or \text?

Thank you so much for you reply

64. Stefan Kottwitz said:

Hi Cesar,

for in-line descriptions \text would be ok, I would not use \mbox. For extra alignment use extra & symbols. However, alignat instead of align might be the better choice then, for aligning at several places.

For longer descriptions use the command \intertext within the environment.

Stefan

Hi Stefan,
I want to align two equations with mathoperators like \prod_{..}^{..}. Align puts the limits behind the operator as in math formulas in the text $..$, not below and above the product symbol. Unfotunately thats quite ugly, is there a way around?

66. Geoff said:

Thanks for all of the answers to how to switch to \align! I’ve still got one problem I can’t figure out how to solve: not all relation symbols are exactly the same width. (For example, I’m trying to use = and \stackrel{\rm def}{=}, but the problem presumably happens with other pairs as well.) Using \eqnarray, the relation symbols were aligned at their centers; with \align they have to be aligned at their left or right edges, which looks ugly. Is there a way to fix this without manually figuring out and inserting the proper amount of extra space?

Thanks,
-Geoff.

67. Geoff said:

For Adrian’s question, an answer might be to use \textstyle or \displaystyle (the former forces subscripts to appear after the operator, the latter above and below).

68. Stefan Kottwitz said:

Hi Geoff,

you could use \mathclap of the mathtools package, which removes the width of the argument, such as
\stackrel{\mathclap{\text{def}}}{=}
I would define a macro for that.

Stefan

69. Stefan Kottwitz said:

for example, \int shows that behavior, in align and also in $$…$$ and $…$. Besides \displaystyle, mentioned by Geoff, you could also use \limits, which affects just that operator, not more, for example:

\int\limits_a^b f(x)dx

Stefan

70. Geoff said:

Thanks, great suggestion!

71. Heather said:

Hi,

I’m having trouble with the labeling of equations within the align environment.
My code is:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
paragraph of text here

\begin{centering}

\begin{align}
a + b &= c + d \label{mylabel1}\\
f + g &= h + k \label{mylabel2}
\end{align}

\end{centering}

This sentance compares \ref{mylabel1} and \ref{mylabel2} …

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

When i try to compile this in latex, i get the errors:

Package amsmath Error: Erroneous nesting of equation structures;
(amsmath) trying to recover with aligned’.
\end{align}
! Package amsmath Error: Multiple \label’s: label ‘mylabel1′ will be lost.

Looking at my document with xdvi i see the two equations labelled by only one equation number (that corresponding to mylabel2).
The only \usepackage i have loaded are amssymb and amsmath

Does anyone know how i can retrieve both labels and refer to them in my text without simply defining two separate equation environments (which works but gives me a very large ugly space between the equations that i would like to eliminate).

Thanks

72. Stefan Kottwitz said:

Hi Heather,

use only align, without equation environment:

\documentclass{article} \usepackage{amsmath} \begin{document} paragraph of text here \begin{align} a + b &= c + d \label{mylabel1}\\ f + g &= h + k \label{mylabel2} \end{align} This sentance compares \ref{mylabel1} and \ref{mylabel2} … \end{document}
73. cagil said:

Hi,
I just want to define 3 variables at the same vertical line but betas doesn’t allow to do that.
Following commands work but beta0,beta1 and RSS are not at tht esame vertical order….

ps: errors are missing or } inserted when I try to put them all into eqnarray or align etc…  \begin{displaymath} \hat{\beta_1} = \frac{\sum_{i=1}^n(x_i-\overline x) (y_i-\overline y)} {\sum_{i=1}^n(x_i-\overline x)^2} \end{displaymath} \begin{eqnarray*} min(RSS) & = & min{\sum_{i=1}^n e_i^2} \\ & = & min{\sum_{i=1}^n ({y_i- \hat{y}})^2} \\ & = & min{\sum_{i=1}^n [y_i-(\hat{\beta_0}+ \hat{\beta_1}x_i)]^2} \\ \end{eqnarray*}  74. Stefan Kottwitz said: Hi cagil, try \begin{document} \begin{align*} \hat{\beta_1} &= \frac{\sum_{i=1}^n(x_i-\overline x) (y_i-\overline y)}{\sum_{i=1}^n(x_i-\overline x)^2}\\ \min(RSS) &= \min{\sum_{i=1}^n e_i^2} \\ &= \min{\sum_{i=1}^n ({y_i- \hat{y}})^2} \\ &= \min{\sum_{i=1}^n [y_i-(\hat{\beta_0} + \hat{\beta_1}x_i)]^2} \end{align*} 75. Jackson said: Hello. I would like to ask for some help in a very simple issue: I have a list (I’m using \itemize) and I want to label it just like I label an equation, for example, because I want to refer to it lately in my text. The reason I don’t use equation environment is that I want that it looks like a list and equation makes everything be on the center. The reason I don’t use flalign is that I don’t want a label for each item I want a label for the whole list. Thank you in advance. 76. Stefan Kottwitz said: Hi Jackson, you could put the itemize list into a theorem environment. It doesn’t have to look like a theorem or definition - this is just a general way to create numbered environments, which can be referred to. 77. Farooq said: I want to add nomenclature list in the middle of page of my research article, but don’t have any idea how to do it. Can anybody help me? 78. Stefan Kottwitz said: Hi Farooq, you could use the nomencl package, or the glossaries package for that. Perhaps visit us in the LaTeX-Community.org forum, where we can discuss such LaTeX problems. 79. Farooq said: Thank you Stefan 80. Farooq said: I want reduce line spacing in the output of the following code, but don’t have any idea. can any body help? Thanks in advance. \documentclass[12pt,runningheads,a4paper]{article} \usepackage{amsmath} \begin{document} \begin{tabular}{p{0.5\linewidth}p{0.5\linewidth}} \begin{description} \item {\textbf{V}} \quad Velocity \item {\rho$} \quad density \item {\textbf{\mbox{\boldmath${\tau}$}}} \quad stress tensor \item {\textbf{I}} \quad Unit tensor \end{description} & \begin{description} \item {$\eta$} \quad parameter \item {$\mu} \quad viscosity \item {p} \quad pressure \item {y} \quad coordinate \end{description}\\ \end{tabular} \end{document} 81. fkibedi said: Hi, I’m trying to use “\align” to display two related equations, with a number on just the second one. But my first equation is short, while the second is long. \align is right-justifying the first equation with the second, while I’d like both equations to be centered. Here’s an example of my code that isn’t working: \begin{align} \label{star} A = B \nonumber \\ AAAAAAAA = BBBBBBBBBBBB \end{align} Thank you! 82. fkibedi said: Actually, it seems that the ams “\gather” works nicely to solve my simple problem above. (Also, I put the \label in the wrong place). Thanks! 83. Stefan Kottwitz said: Hi fkibedi! Yes, fortunately amsmath provides various multi-line environments with different alignment. 84. fahrettin said: Hi Mr. Kottwitz I am new with this latex stuff I dont know what will I do. You may help me. Thanks \documentclass[a4paper,12pt]{report} %\documentclass[a4paper, 12pt]{nigde} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage{graphicx} \usepackage{epstopdf} \usepackage{thesis,moreverb,longtable,subfigure} \usepackage{epsfig} \usepackage{color} \hyphenpenalty=10000 \tolerance=10000 %\usepackage{amsvath} % Use amstex package for special math function, like tripledot \usepackage{amsmath} \usepackage{caption2} \usepackage[amsmath,thmmarks]{ntheorem} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% I have problem with these warnings and errors LaTeX Warning: Reference table:Initial Models3′ on page 42 undefined on input line 8. LaTeX Warning: Command \. invalid in math mode on input line 14. ! Argument of \T1\. has an extra }. \par l.14 \end{flalign} %%%%%%%%%%%%%%%%%%%%%%%% Runaway argument? ! Paragraph ended before \T1\. was complete. \par l.14 \end{flalign} %%%%%%%%%% ? ! Missing inserted.

l.14 \end{flalign} %%%%%%%%%%%%%%%%%%%%%%%% Runaway argument? ! Paragraph ended before \T1\. was complete. \par l.14 \end{flalign} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ! Extra }, or forgotten.
}
%%%%%%%%%%%%%%%%%%%%%%%

85. François said:

Hello Stefan,

Anna wrote you already my problem “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.”, but you couldn’t help her.

Please, could you help me to overcome this problem? :-)

\begin{flalign*}
& \mbox{équations de continuité} &
\mbox{div \textbf{J$_n$}} & =\ee(G-R)-e\frac{\partial n}{\partial t} & \mbox{div \textbf{J$_p$}} & =\ee(G-R)-e\frac{\partial p}{\partial t}\label{divj}\\
& \mbox{équations du courant} &
\textbf{J$_n$} & =-n\ee\mu_n\textbf{E}-\ee D_n\textbf{grad}n &
\textbf{J$_p$} & =p\ee\mu_p\textbf{E}-\ee D_p\textbf{grad}p \label{jjj}
\end{flalign*}