For Programmers: Free Programming Magazines  


Home > Archive > Tex > September 2006 > aligning equations with amsmath









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author aligning equations with amsmath
icksa1@gmail.com

2006-09-26, 8:45 am

Hi:
I am using amsmath to make blocks of equations for example:

\begin{align}
VA &= 2*x + 3 + \\
& 4x^2 + 8x^3 + \\
& sin(y)
\end{align}

or something similar. These equations are always centered. I know I can
put fleqn in my document class, but I would like the flexibility to
change the alignment for each equation block (make some centered or
some left justified). Is there any way to do this?

Thanks

Enrico Gregorio

2006-09-26, 8:45 am

<icksa1@gmail.com> wrote:

> Hi:
> I am using amsmath to make blocks of equations for example:
>
> \begin{align}
> VA &= 2*x + 3 + \\
> & 4x^2 + 8x^3 + \\
> & sin(y)
> \end{align}
>
> or something similar. These equations are always centered. I know I can
> put fleqn in my document class, but I would like the flexibility to
> change the alignment for each equation block (make some centered or
> some left justified). Is there any way to do this?


Use mathtools and its "multlined" environment.

Ciao
Enrico
Herbert Voss

2006-09-26, 8:45 am



icksa1@gmail.com wrote:
> Hi:
> I am using amsmath to make blocks of equations for example:
>
> \begin{align}
> VA &= 2*x + 3 + \\
> & 4x^2 + 8x^3 + \\
> & sin(y)
> \end{align}
>
> or something similar. These equations are always centered. I know I can
> put fleqn in my document class, but I would like the flexibility to
> change the alignment for each equation block (make some centered or
> some left justified). Is there any way to do this?


ftp://dante.ctan.org/tex-archive/in...de/Mathmode.pdf

Herbert


--
http://PSTricks.de/
http://TeXnik.de/
http://www.dante.de/CTAN/info/math/...de/Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq...ntroduction=yes

Lars Madsen

2006-09-26, 7:06 pm

icksa1@gmail.com wrote:
> Hi:
> I am using amsmath to make blocks of equations for example:
>
> \begin{align}
> VA &= 2*x + 3 + \\
> & 4x^2 + 8x^3 + \\
> & sin(y)
> \end{align}
>
> or something similar. These equations are always centered. I know I can
> put fleqn in my document class, but I would like the flexibility to
> change the alignment for each equation block (make some centered or
> some left justified). Is there any way to do this?
>
> Thanks
>


using recommended AMS rules (from mathematics into type, converted into
using align, note that the +'s at the breaks goes first on the line not
last)

\begin{align}
VA = {} & 2x+3 \\
& + 4x^2+8x^3\\
& \sin(y)
\end{align}

/daleif

icksa1@gmail.com

2006-09-26, 7:06 pm


Enrico Gregorio wrote:
> <icksa1@gmail.com> wrote:
>
>
> Use mathtools and its "multlined" environment.
>
> Ciao
> Enrico


According to what I read, multlined puts the first line to the left,
the middle lines center and the last line to the right. But is there
anyway to have complete control of the alignment? So I can say, for
example...center this equation but right justify that one. And I should
say that I'm very new to tex.

THanks

Paul

2006-09-26, 7:06 pm

You could use

\begin{flalign}
VA &= 2*x + 3 + & \\
& 4x^2 + 8x^3 + \\
& sin(y)
\end{flalign}

Notice the extra '&' before the first '\'.


icksa1@gmail.com wrote:
> Hi:
> I am using amsmath to make blocks of equations for example:
>
> \begin{align}
> VA &= 2*x + 3 + \\
> & 4x^2 + 8x^3 + \\
> & sin(y)
> \end{align}
>
> or something similar. These equations are always centered. I know I can
> put fleqn in my document class, but I would like the flexibility to
> change the alignment for each equation block (make some centered or
> some left justified). Is there any way to do this?
>
> Thanks


Dan

2006-09-27, 7:07 pm


Paul wrote:

> \begin{flalign}
> VA &= 2*x + 3 + & \\


Better: VA &= 2x + 3 + {} \\
Without the empty formula "{}" the plus sign has the wrong
spacing. The extra & only adds one additional intercolumn space
at the end, which has no visible effect.

> & 4x^2 + 8x^3 + \\


Here, too, we need a "{}" after the plus sign.

Probably one doesn't want to align "4x^2" with the equal sign
above it. One needs to either add some space before that or
follow Lars' suggestion (moving the alignment tab on the first
line).

> & sin(y)


Of course you meant \sin.

But flalign is the way to go to get the alignment flush left.
Unfortunately, if there are side-by-side equations,
(i.e., additional "& a &= B" in one row) they get pushed flush
right.


Dan

Dan

2006-09-27, 7:07 pm


Herbert Voss wrote:

>
> ftp://dante.ctan.org/tex-archive/in...de/Mathmode.pdf


There is an apparent misprint in the example align on
page 50: an extra "&" in the first row of that align puts
the last entry in that row too far right compared to the
row below.


Dan

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com