Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

align equation elements all left (No, not fleqn)

40 views
Skip to first unread message

Ryo

unread,
Aug 22, 2011, 6:54:18 PM8/22/11
to
Hi,

I was wondering how to vertically align equation elements all flush
left. For example,

\begin{align*}
f(x) &= x + 1 & \text{(when blah)} \\
f(x,y) &= x + y & \text{(when blah blah)}
\end{align*}

I'd like to avoid this because the first and last columns are flush
right. I want the left edges of all three elements in a line aligned
vertically, as if there were in a tabular, such as

\begin{tabular}{lll} % all flush left
f(x) &= x + 1 & when blah \\
f(x,y) &= x + y & when blah blah\\
\end{tabular}

Regards,
Ryo

KF Leong

unread,
Aug 23, 2011, 12:01:36 AM8/23/11
to
On Aug 23, 6:54 am, Ryo <ryofu...@gmail.com> wrote:
> Hi,
>
> I was wondering how to vertically align equation elements all flush
> left.  For example,
>
> \begin{align*}
>   f(x)    &= x + 1 & \text{(when blah)} \\
>   f(x,y) &= x + y & \text{(when blah blah)}
> \end{align*}
>

Just add another alignment character for the function column:

\begin{align*}
&f(x) &= x + 1 \quad & \text{(when blah)} \\
&f(x,y) &= x + y \quad & \text{(when blah blah)}
\end{align*}

Note: \quad to add space between equation and text

KF

KF Leong

unread,
Aug 23, 2011, 1:04:16 AM8/23/11
to
On Aug 23, 6:54 am, Ryo <ryofu...@gmail.com> wrote:
> Hi,
>
> I was wondering how to vertically align equation elements all flush
> left.  For example,
>
> \begin{align*}
>   f(x)    &= x + 1 & \text{(when blah)} \\
>   f(x,y) &= x + y & \text{(when blah blah)}
> \end{align*}
>

Hmm... it seems the earlier answer has spacing between function and
equal sign too wide!

This is a more pleasing answer:

\begin{alignat*}{2}


&f(x) &= x + 1 \quad &\text{(when blah)} \\

&f(x,y)\ &= x + y \quad &\text{(when blah blah)}
\end{alignat*}

Note the additional space (\ ) require for the second function
equation.

KF

Dan Luecking

unread,
Aug 23, 2011, 11:33:23 AM8/23/11
to
On Mon, 22 Aug 2011 15:54:18 -0700 (PDT), Ryo <ryof...@gmail.com>
wrote:

In align and alignat the columns are alternately right
and left aligned. So you could just leave the odd numbered
columns empty. The align environment add space between even
and odd columns, so you need alignat, and then add whatever
space you need:

\begin{alignat*}{3}
&f(x) &&= x^2 + x + 1 &&\quad \text{(when blah)} \\
&f(x,y) &&= x + y &&\quad \text{(when blah blah)}
\end{alignat*}


Dan
To reply by email, change LookInSig to luecking

Ryo

unread,
Aug 23, 2011, 5:02:26 PM8/23/11
to
Thank you all who responded!

> In align and alignat the columns are alternately right
> and left aligned. So you could just leave the odd numbered
> columns empty.

Aha! I should've figured that out for myself. Thanks.

At this occasion, I also learned the differences between align and
alignat .

Cheers,
Ryo

0 new messages