Align left-aligned formula at two points
You can use \phantom
to apply the appropriate spacing within the align
environment to ensure that the y
is aligned with the a
and the =
signs are also aligned. If you want this entire equation adjacent to the left margin you can use flalign
.
Note:
- Note the trailing
&
which is needed to get equation all the way to the left margin.
Code:
\documentclass{article}
\usepackage{amsmath}
%\usepackage[showframe]{geometry}% Uncomment to see margins
\begin{document}
\begin{flalign*}
a+b+c&=1 &\\% Need this trailing alignment char to get all the way left
y\phantom{{}+b+c} &=2 &
\end{flalign*}
\end{document}
You can use "big fractions" also inside array
; using the array
package helps, so say
\usepackage{array}
in your preamble. Then you can use
\begin{array}{@{}>{\displaystyle}l@{}>{\displaystyle{}}l@{}}
a+b+c &= y \\
y &= \frac{2}{3}
\end{array}
just as a single (math) object that you can put anywhere you like. Adding \vphantom{\frac{2}{3}}
before the \\
in the first row can help spacing.
For example, with
\begin{flalign*}
\begin{array}{@{}>{\displaystyle}l@{}>{\displaystyle{}}l@{}}
a+b+c &= y \vphantom{\frac{2}{3}}\\
y &= \frac{2}{3}
\end{array}
&&
\end{flalign*}
you'll get the object flush with the left margin.
Here's your answer
\begin{alignat*}{2}
&a+b+c&&=1\\
&y&&=2
\end{alignat*}
Explanation: align
is an environment for shifting between left-aligned columns and right-aligned ones, so if you want your equation to be shown as a totally left-aligned one, you need to add an extra column between the left-aligned columns. In the above example, first &
in each line makes a left-aligned column, if you delete this ones you'll get a right-aligned column. The second ampersands in each line make a right-aligned column but we don't need this column so we add a third column by adding an &
after the last ampersands in each line. flalign
is a variation of align
that increases the space between columns so as to cover the line completely. alignat
omits unnecessary spaces between the columns (the other difference between alignat
and align
is that the first one takes an argument which shows the number of the columns). Note that adding a *
after each of these three, makes them untaged.