[Tex/LaTex] Equation align left instead of right? (not what has been answered before)

alignequationsformatting

I am absolutely blown away. I have spent a month on and off looking for a solution to this extremely obvious issue and it has not be addressed anywhere that I can see.

When using align for equations, unless I spam & before every single line I write, the default equation alignment is to the last character of each line, which results in the equations being in a way nobody would ever want to read.

How do I permanently set align to align to the first character of each line without having to & every line?

[![\begin{align}
T=\f{1}{2}m\dot{x}_1^2+\f{1}{2}\dot{x}_2^2\\
U_{spring}=\f{1}{2}kx^2\\
U=\f{1}{2}kx_1^2+\f{1}{2}kx_2^2+\f{1}{2}k_{12}(x_2-x_1)^2\\
\L=T-U\\
\pd{\L}{x_1}=\d{}{t}\pd{\L}{\dot{x}}_1\Rightarrow-\f{1}{2}k2x_1-\f{1}{2}k_{12}2(x_2-x_1)(-)=m\ddot{x}_1\\
m\ddot{x}_1=-kx_1+k_{12}x_2-k_{12}x_1=-(k+k_{12})x_1+kx_2\\
=-(k+k_{12})x_1+k_{12}x_2\\
m\ddot{x}_2=k_{12}x_1-(k+k_{12})x_2
\end{align}][1]][1]

enter image description here
What I want:

\begin{align}
&T=\f{1}{2}m\dot{x}_1^2+\f{1}{2}\dot{x}_2^2\\
&U_{spring}=\f{1}{2}kx^2\\
&U=\f{1}{2}kx_1^2+\f{1}{2}kx_2^2+\f{1}{2}k_{12}(x_2-x_1)^2\\
&\L=T-U\\
&\pd{\L}{x_1}=\d{}{t}\pd{\L}{\dot{x}}_1\Rightarrow-\f{1}{2}k2x_1-\f{1}{2}k_{12}2(x_2-x_1)(-)=m\ddot{x}_1\\
&m\ddot{x}_1=-kx_1+k_{12}x_2-k_{12}x_1=-(k+k_{12})x_1+kx_2\\
&=-(k+k_{12})x_1+k_{12}x_2\\
&m\ddot{x}_2=k_{12}x_1-(k+k_{12})x_2
\end{align}

enter image description here

Best Answer

You should do two things: use \documentclass[fleqn]{article} (or whichever document class you're using), but also use gather instead of align. align and its cousins are for vertically aligning text around some specified character, usually =, but gather is for a general list of equations. (You can also use gather* to get an un-numbered version.)

\documentclass[fleqn]{article}
\usepackage{amsmath}

\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\dfr}[2]{\frac{d #1}{d #2}}

\begin{document}
Here is some text.
\begin{gather}
T = \frac{1}{2}m\dot{x}_1^2 + \frac{1}{2}\dot{x}_2^2\\
U_{\text{spring}} = \frac{1}{2}kx^2\\
U = \frac{1}{2}kx_1^2 + \frac{1}{2}kx_2^2 + \frac{1}{2}k_{12}(x_2 - x_1)^2\\
\mathcal L = T-U\\
\pd{\mathcal L}{x_1} = \dfr{}{t}\pd{\mathcal L}{\dot{x}}_1\Rightarrow -
    \frac{1}{2}k2x_1 - \frac{1}{2}k_{12}2(x_2 - x_1)(-) = m\ddot{x}_1\\
m\ddot{x}_1 = -kx_1 + k_{12}x_2 - k_{12}x_1 = -(k+k_{12})x_1 + kx_2\\
=-(k + k_{12})x_1 + k_{12}x_2\\
m\ddot{x}_2 = k_{12}x_1 - (k + k_{12})x_2
\end{gather}
\end{document}

enter image description here

If you really want to redefine align in particular, you could call

\renewenvironment{align}{\gather}{\endgather}

in your preamble and just use align where I used gather, but that makes your code less clear.

Related Question