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.

Is there a way possible to imitate the align environment for math mode commands, without having all writing being placed toward the center on the output page?

MWE:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{align*}
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) \\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2)
\end{align*}

\end{document}
share|improve this question
    
It's not clear by what you mean by without having everything being centered on the output page. For one, it is the gather and gather* environments rather than the align and align* environments which center their output on a line. –  Mico Sep 16 '11 at 10:51
1  
is there a reason you are adding spaces \; around the equal signs? this wide spacing is reminiscent of what is produced by \eqalign, and it's not considered good style in mathematics publications. –  barbara beeton Sep 16 '11 at 14:39

3 Answers 3

up vote 13 down vote accepted

The amsmath package has a fleqn option which, according to the manual (texdoc amsmath) has the following effect:

Position equations at a fixed indent from the left margin rather than centered in the text column.

Thus:

\usepackage[fleqn]{amsmath}

seems to be what you are after.

The mathtools package loads amsmath internally and passes any unknown arguments on to it. This includes the fleqn option. Thus:

\usepackage[fleqn]{mathtools}

also works.

Here's a comparison of the outputs. The upper one is without fleqn and the lower one with.

fleqn option

share|improve this answer
    
Andrew, Thanks. So is there an option for this as well using the mathtools package or is it already built in somehow? –  night owl Sep 16 '11 at 12:32
    
@night owl: I didn't realise you were using mathtools. As that loads amsmath it's easy to adapt my answer to that case. I've updated my answer. –  Loop Space Sep 16 '11 at 13:17
    
@AndrewStacey I just tried this, but my equations do not get flushed entirely to the left (there is still some margin on the left hand side). What could I try to remove this remaining margin? –  rbm Nov 13 '13 at 18:22

As Andrew mentions you can use \usepackage[fleqn]{amsmath}, but this will mean tha all you equations will be moved to the left.

However, if you want to be able to have some centered and some on the left than than you can use the flalign environment. But, note the trailing & that is required when this is used. As mentioned by egreg, the trailing & in the flalign environment is only required in one of the lines.

\documentclass{article}
\usepackage{amsmath}% mathtools includes this so this is optional
\usepackage{mathtools}

\begin{document}
\begin{align*}% centered
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) \\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2)
\end{align*}

\begin{flalign*}% left aligned
\cos\theta_1 \cos\theta_2-\sin\theta_1\sin\theta_2 &= \cos(\theta_1 +\theta_2) &\\
\sin\theta_1 \cos\theta_2 + \cos\theta_1 \sin\theta_2 &= \sin(\theta_1+\theta_2) &% Need tailing alignment char to get all the way left
\end{flalign*}
\end{document}

I removed the \; from the OP's MWE, which inserted additional spacing where it was not necessary.

share|improve this answer
2  
One can add, say, \qquad in front of the first line in order not to get left flushing; the trailing & is needed only in one of the lines. Note that those \; commands are wrong. –  egreg Sep 16 '11 at 13:18
    
Nice to know about that. (To produce the picture in my (updated) answer, I introduced a \fleqn hack that reset stuff according to the fleqn option. If I'd known about falign ...) –  Loop Space Sep 16 '11 at 13:19
    
@egreg: Totally agree. I noticed those, but since it appeared that \; were intentionally added, it was the OPs style of choice to have additional space. –  Peter Grill Sep 16 '11 at 13:25
    
@Andrew: Wow!! Can't believe that I was actually able to teach you something.. –  Peter Grill Sep 16 '11 at 13:26
1  
Just remove the \; and you'll get the "correct" spacing. It is preferable to let TeX determine the spacing so that it is consistent. I have removed them form this answer in case others see this and think that they should be there. –  Peter Grill Sep 16 '11 at 17:30

I'm not sure what you mean by "immitate", but I guess you mean you don't want the equations centered, but aligned in another way. A MWE would have been nice, to better understand your problem, to know what documentclass you are using, etc. Anyway, you can have equations aligned differently with align, if you load the amsmath package and write something like this:

\documentclass[a4paper,10pt,fleqn]{article}
\usepackage{amsmath}
\setlength{\mathindent}{1cm}
\begin{document}
\noindent Blah
\begin{align*}
y = ad + da\\
y = ad + da
\end{align*}
\end{document}

As you probably guessed, \setlength{\mathindent}{1cm} lets you control the indentation.

share|improve this answer
    
Very useful comment. I was perplexed by the indentation that was still present in my text. –  m33lky Feb 2 at 4:31

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.