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