Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following is a small example to use flalign environment to generate equation.

\documentclass{article}
\usepackage{amsmath}
\usepackage{txfonts}

\begin{document}
The formula is:
\begin{flalign*}
  \lambdaup &= \lambdaup_1 + \lambdaup_2\\
\end{flalign*}

\end{document}

The output aligns at the center:

The formula is
                  lambda = lambda_1 + lambda_2

How can I make the alignment to the left, using flalign, alignat or align environment? I mean:

The formula is
lambda = lambda_1 + lambda_2

According to Michael's comment, adding option [fleqn] to package amsmath and setting \mathindent=0.0pt will solve the problem. But this will make all equations align to the left. How can I make the function locally to some environment instead of the whole article?

share|improve this question
2  
Displayed equations are usually centered. You can pass the option fleqn to either the document class or to amsmath to get displayed equations that are aligned to the left. However, they are still indented slightly unless you change the value of mathindent. –  Michael Ummels Mar 23 '11 at 8:27
    
@Michael: Yes, mathindent is a point. –  warem Mar 23 '11 at 9:13

3 Answers 3

up vote 19 down vote accepted

You can use Flalign instead.

The formula is
\begin{flalign*}
a &= b+c &\\
  &= 1+1 &\\
  &= 2  &
\end{flalign*}
share|improve this answer
    
It worked. Thank you. –  warem Mar 23 '11 at 8:34
1  
I just found that if the content in flalign has math, it doesn't work. Please have a look at the updated example. –  warem Mar 23 '11 at 9:01
8  
You need to add & after each line, i.e. write \lambdaup &= \lambdaup_1 + \lambdaup_2 &. –  Michael Ummels Mar 23 '11 at 10:17
1  
@Michael: yes, adding & at the end of line does work. Thank you. –  warem Mar 23 '11 at 14:21

The trick is to give amsmath the parameter fleqn:

\usepackage[fleqn]{amsmath}

Edit: This produces a slightly different output than flalign*.

share|improve this answer
    
@Michael: Now I know the option fleqn. Thank you. I think this option will work for all equations in article. This is its advantage and disadvantage since not all equations will be displayed to the left. So it is better to set right environment at where you want, just like what Lauer does. –  warem Mar 23 '11 at 8:43

Using the flalign environment (numbered equations) or the flalign* (unnumbered equations) environment, left alignment can be obtained with two ampersands (&). If the only alignment you want is for the equations to be left-aligned, put an ampersand at the beginning and end of each line, like so:

\begin{flalign*}
  & \lambda = \lambda_1 + \lambda_2 &\\
  & \Lambda = \Lambda_1 + \Lambda_2 &
\end{flalign*}

If you want to have left-alignment but also align by some character (say, the = sign), put the first ampersand immediately before the character you want to align by, and the second ampersand at the end of each line, like so:

\begin{flalign*}
  \lambda &= \lambda_1 + \lambda_2 &\\
          &= \Lambda &\\
          &= \Lambda_1 + \Lambda_2 &
\end{flalign*}

Credit to Lauer, whose answer I used to help me figure out the same issue, then expanded upon.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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